Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Need Help with some PLSQL code please
"andrewst" <member14183_at_dbforums.com> wrote in message
news:3366724.1063470436_at_dbforums.com...
|
| An EXCEPTION raised in the declaration section of a PL/SQL block is not
| handled by the block's own exception handler. Like these:
Hi andrewst.
| TempID VARCHAR2( 50 ) := CHECK_PROCESS_ID( MyNumber ); -- Returns
| a VARCHAR2
|
| TempDate VARCHAR2( 50 ) := CHECK_MY_DATE( MyDate ); -- Returns a
| VARCHAR2
|
|
|
| Move the assignments into the body if you want to handle them yourself.
Ok, I'll give that a try.
| Other comments:
|
|
|
| 1) Rather than concern yourself with the closing of cursors in the
| exception handler, why not use a simple FOR loop?
|
|
|
| FOR myRow IN MyCursor LOOP
|
| ..
|
| END LOOP;
Because I'm still a newbie with this stuff :-).
So does this mean, that at the closing scope of the for loop, the cursor is automatically closed ?
| (No need to declare MyRow in that case either).
Good point.
| 2) I don't like this:
|
|
|
| WHEN OTHERS THEN
|
| DBMS_OUTPUT.PUT_LINE( '-----------------------------------------' );
|
| DBMS_OUTPUT.PUT_LINE( 'Unknown Error Occured. ' );
|
| DBMS_OUTPUT.PUT_LINE( '-----------------------------------------' );
|
|
|
| The only reason the error is "unknown" is because you've prevented
| Oracle from telling you what it is! Why not just use RAISE here?
I'm not sure how to use RAISE on its own ?, at this stage. I will have to read up on it.
| 3) Your CHECK_PROCESS_ID function has 2 different return values, but
| your main program doesn't care about the difference.
Yeah. I meant to use these return values, but overlooked them. Thanks for pointing that out.
Thanks.
Chris Val
Received on Sat Sep 13 2003 - 12:30:06 CDT