Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: beginner Help me!
Srinivas,
You have to first buy the book Orcale PL/SQL by Steveb feuerstein otherwise you are going to learn things the wrong way and you will be doomed all you life just writing wrong constructs and debugging the same.
Standards- Use meaningful name for varables and cursors.
Always try to mimic the datatype of the variable with the datatype of the
column name. This way you don't have to make changes to the code if the
datatype of of col changes.
name the cursor with something that has meaning and suffix that name with
_cur. So you know it is a cursor.
CurSor rules: Declare, OPEN, fetch and close. You have missed the OPEN cursor.
ALWAYS have an exception handler for each block. You can trap the error if the select fails or returns no rows at all. Without Exception forget about programming.
DECLARE _cur;
OPEN _cur;
FETCH _cur into variable(s)
EXIT WHEN _cur%NOTFOUND immediately. This is only when you have a loop.
YOU must close the cursor with CLOSE cursor name. If the select is done often, put it in a procedure. So you just call the procedure. If the select changes, you have to just alter the select in the procedure and no where else.
HTH Cecil
Srinivasan Vinod wrote in message <34591565.155E_at_tntech.edu>...
>hello
>
Received on Sat Nov 01 1997 - 00:00:00 CST
![]() |
![]() |