23.10.2012 Views

Structured Query Language (SQL) - Cultural View of Technology

Structured Query Language (SQL) - Cultural View of Technology

Structured Query Language (SQL) - Cultural View of Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PL/<strong>SQL</strong> 80<br />

BEGIN<br />

END;<br />

FOR RecordIndex IN cursor_person<br />

LOOP<br />

DBMS_OUTPUT.PUT_LINE(RecordIndex.person_code);<br />

END LOOP;<br />

The concept <strong>of</strong> the person_code within the FOR-loop gets expressed with dot-notation ("."):<br />

RecordIndex.person_code<br />

Example<br />

declare<br />

begin<br />

end;<br />

Output:<br />

0<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

var number;<br />

/*N.B. for loop variables in pl/sql are new declarations, with scope only inside the loop */<br />

for var in 0 .. 10 loop<br />

end loop;<br />

dbms_output.put_line(var);<br />

if (var is null) then<br />

else<br />

end if;<br />

var is null<br />

dbms_output.put_line('var is null');<br />

dbms_output.put_line('var is not null');

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!