Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Dynamic SQL-Command in PL/SQL
In article <421f02db$0$3680$4d4ef98e_at_read.news.ch.uu.net>, COAST says...
> PROCEDURE MY_PROC(myVar IN NUMBER,) IS
> BEGIN
>
> DECLARE
>
> BEGIN
>
>
> FOR myAttributes IN ( select myAttribute into myAttributeResult from myTable
> where myNumber = myVar;)
> LOOP
>
> doSomething();
>
> END LOOP;
>
> END;
> END;
>
> Now I've got the problem if myVar is NULL then I want to have ALL entries.
>
>
Do
PROCEDURE MY_PROC(myVar IN NUMBER,) IS
BEGIN
DECLARE
BEGIN
FOR myAttributes IN ( select myAttribute
into myAttributeResult from myTable where myNumber = nvl(myVar,myNumber) )
hth
-- jeremyReceived on Sat Feb 26 2005 - 12:35:50 CST