Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Please check this syntax
DA Morgan <damorgan_at_x.washington.edu> wrote in message news:<1112454910.979041_at_yasure>...
> To quote Jim Kennedy, "don't write generic code it will bite you."
>
> That someone may wish to have you write 30 more is called job
> security. Code them properly and do not use native dynamic SQL.
> NDS may be simple ... but you pay a price in debugging and in
> the use of resources.
>
> I can no longer, from my newreader see the code to determine if it
> is syntactically correct but the EXECUTE IMMEDIATE would never have
> generated an error so if the point was to generate an error in a
> specific condition your code wouldn't have accomplished that.
>
> I would suggest reposting your code and, more importantly, describing
> the business rule.
>
> Finally ... you obviously have a computer handy so why don't you also
> have Oracle on it?
Here my code again:
v_compType VARCHAR2(4); v_sql VARCHAR2(500); v_bgtNo VARCHAR2(24);
BEGIN
EXECUTE IMMEDIATE v_sql INTO v_bgtNo USING :newRow.COMPKEY;
IF v_bgtNo IS NULL THEN RAISE_APPLICATION_ERROR(-20100, '##Budget Number field must be populated##'); END IF;
RAISE_APPLICATION_ERROR (-20100, Err_Desc);
END;
Like I said before the trigger is supposed to: 1. Determine which table the BGTNO is stored in 2. Raise an application error is the BGTNO is null Performance is not an issue due the conditions under which this trigger will fire.
You said this code will never generate an error - can you please explain why? Similar code in T-SQL would work.
I am on the other side of the country to my company's Oracle CDs until the end of next week so unfortunately I'm writing this blind in the meantime.
Thanks again. Received on Sat Apr 02 2005 - 22:04:07 CST
![]() |
![]() |