Showing posts with label Variables. Show all posts
Showing posts with label Variables. Show all posts

Tuesday, May 19, 2009

Boolean Variables

If a boolean variable is not initialized it isn’t true or false. Use NVL to have it take the appropriate course.

Declare
Bool_Var Boolean ;
Begin
If Not Nvl(Bool_Var,False)
Then Dbms_Output.Put_Line('False or Not Initialized');
Else Dbms_Output.Put_Line('True');
End If;
End;
/

Tuesday, March 3, 2009

RefCursor Bind Variables

Store select statements in the database and reference them from Sql*Plus. Note: To print again, the PL/Sql block must be executed again.
Variable Emp_Info Refcursor

Begin
Open :Emp_Info For Select EName
, Sal
From Emp
Where Job = 'SALESMAN' ;
End;
/

Print Emp_Info