Good day. I have a function:
create function get_n(search tt.pp%type)
return number
is rc number;
begin
select count(*)
into rc
from tt
where tt.pp=search;
return (rc);
end;
/
and i can get result as
variable qwe number;
begin
select get_n('sample')
into :qwe
from dual;
end;
print qwe;
So, it's successfully works. But by parts: i can't exec line with print at execution of other (PLS-00103: Encountered the symbol "PRINT"...). And it's really strange.
I try to get result from function in anonymous block and print it:
declare
qwe number;
begin
select get_n('sample')
into :qwe
from dual;
dbms_output.put_line(qwe);
exception
when others
then dbms_output.put_line(sqlerrm);
end;
/
And it's not print anything. Why?
:=the value of the function, but why this doesn't works?qwe := get_n('sample')?