-
executing function on SQL prompt
Hi All
How to execute a FUNCTION on SQL prompt. I know about using the command 'variable ' and then assigning output to it. But I dont know how to assign returning value of a function to it.
I have done
variable i number
i := exec reval(2);
print i
This does not work but ....
If I execute it in begin ... end block it shows proper out put.
What is the way I can see output in variable i.
Amol
-
Re: executing function on SQL prompt
Originally posted by amolik
Hi All
print i
Amol
Print???
this seems to be SQL Server command....rather than oracle...
funky...
"I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."
"Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"
-
Code:
lsc@DEV817-ES7J2BKT8ZM0YY>create or replace function mynumber
2 return number
3 as
4 l_number number;
5 begin
6 select 1
7 into l_number
8 from dual;
9 return l_number;
10 end;
11 /
Function created.
lsc@DEV817-ES7J2BKT8ZM0YY>variable x number
lsc@DEV817-ES7J2BKT8ZM0YY>exec :x:=mynumber
PL/SQL procedure successfully completed.
lsc@DEV817-ES7J2BKT8ZM0YY>print x
X
----------
1
-
Re: Re: executing function on SQL prompt
Originally posted by abhaysk
Print???
this seems to be SQL Server command....rather than oracle...
SQL*Plus reference manual is a good reading sometimes......
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
-
Re: Re: Re: executing function on SQL prompt
Originally posted by jmodic
SQL*Plus reference manual is a good reading sometimes......
I shud start i think...
funky...
"I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."
"Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"
-
Works as well ...
Code:
select reval(2) from dual;
Ales The whole difference between a little boy and an adult man is the price of toys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|