declaration nvl2 function in pl/sql
874760Jul 13 2011 — edited Jul 14 2011Hello,
I am a newbie on PL/SQL Programming. I can not execute the program.. The error message is : ORA-00904: "others": invalid identifier
I defined the others but I didn't do in a proper way I guess..I look forward to hearing your advise.
Thanks,
create or replace
procedure PROCEDURE3 AUTHID CURRENT_USER
AS
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE MARGIN_2 AS
SELECT NVL2(cbyc_oems.oem,cbyc_oems.oem,"others") AS OEM,
world.template_country,
world.template_region,
SUM(thisysales.top)
FROM( ( THISYSALES LEFT JOIN WORLD ON thisysales.country=world.code) LEFT JOIN
oem_cage_codes ON THISYSALES.MFG_CODE=oem_cage_codes.oem_cage_code) LEFT JOIN cbyc_oems ON oem_cage_codes.code=cbyc_oems.oem
GROUP BY
NVL2(cbyc_oems.oem,cbyc_oems.oem,"others").
world.template_country,
world.template_region';
end procedure3;