Home » SQL & PL/SQL » SQL & PL/SQL » explanation needed
explanation needed [message #38386] Tue, 16 April 2002 06:52 Go to next message
meenu sharma
Messages: 5
Registered: April 2002
Junior Member
Hi ,
I recently came across the following statement
but haven't been able to understand it.
Can anybody help.
Thanks,
Meenu
Here is the dynamic if statement -

declare
x varchar2(1000) := '1=2 and 4 in(5,6)';
y VARCHAR2(2000) ;
a varchar2(2000);
z number;
begin
y:='declare a varchar2(2000); BEGIN a := ''' || x ||'''; :z:=1; END;';
EXECUTE IMMEDIATE (y) using out z;
if (z=1) then
dbms_output.put_line('True : ' || x);
else
dbms_output.put_line('False : ' || x);
end if;
end;
Re: explanation needed [message #38406 is a reply to message #38386] Tue, 16 April 2002 23:57 Go to previous message
Epe
Messages: 99
Registered: March 2002
Member
Hello,

as I read it, it's a piece of code to check if the commands in variable y are executed by the "execute immediate" command. If they are executed correctly, z should be returned as out parameter and therefor contain the value 1 (creating the output 'True : ...'), if not null (creating the output 'False : ...').
Comment : I don't see why the variable a is declared in the main program...

I hope your sky cleared up a little bit...

epe
Previous Topic: Using DBMS_SQL
Next Topic: Updating table
Goto Forum:
  


Current Time: Mon May 06 09:55:04 CDT 2024