select case trunc(sysdate)
when to_date('2022/10/11', 'YYYY/MM/DD')
then '#JoelKallmanDay'
end as hashtag
from dual
HASHTAG | - |
---|
declare
l_hashtag varchar2(100);
l_date date;
begin
l_date := trunc(sysdate);
--
case l_date
when to_date('2022/10/11', 'YYYY/MM/DD')
then l_hashtag := '#JoelKallmanDay';
end case;
--
dbms_output.put_line(l_hashtag);
end;
ORA-06592: CASE not found while executing CASE statement ORA-06512: at line 10 ORA-06512: at "SYS.DBMS_SQL", line 1721More Details: https://docs.oracle.com/error-help/db/ora-06592
declare
l_hashtag varchar2(100);
l_date date;
begin
l_date := trunc(sysdate);
--
l_hashtag := case l_date
when to_date('2022/10/11', 'YYYY/MM/DD')
then '#JoelKallmanDay'
end;
--
dbms_output.put_line(l_hashtag);
end;
Statement processed.
create function f_case_expression_test (p_date in date)
return varchar2 is
l_hashtag varchar2(100);
begin
case p_date
when to_date('2022/10/11', 'YYYY/MM/DD')
then l_hashtag := '#JoelKallmanDay';
end case;
--
return l_hashtag;
end f_case_expression_test;
Function created.
select f_case_expression_test(trunc(sysdate)) from dual
ORA-06592: CASE not found while executing CASE statementMore Details: https://docs.oracle.com/error-help/db/ora-06592