0

I've searched and searched and I can't figure out what's wrong.

Without going into detail of what exactly is in these tables (they are pretty basic varchar columns, nothing out of the ordinary), why does this keep giving me the 'SQL command not properly ended' error.

The first NVL is so I can set the SPID_NAME to 'Unknown' if there is no match between SN1.SUB_GRP_NAME and L1.SUB_GRP_NAME.

The second NVL is used because sometimes L1.SUB_GRP_NAME is NULL, and I change it to '9999'.

I'm using PLSQL/Oracle Developer 3.1.07.

update L1
SET L1.SPID_NAME = NVL(SUB_GRP_TO_NAME.SPID_NAME, 'Unknown')
from ACME_NORMAL L1
left outer join SUB_GRP_TO_NAME SN1
on SN1.SUB_GRP_NAME = NVL(L1.SUB_GRP_NAME,'9999');
sampathsris
  • 21,564
  • 12
  • 71
  • 98
Morris.C
  • 1
  • 1
  • When you alias SUB_GRP_TO_NAME as SN1 you should remember to use the alias everywhere; including in `NVL (SUB_GRP_TO_NAME.SPID_NAME, 'Unknown') ` to make it `NVL(SN1.SPID_NAME, 'Unknown')` – Pieter Geerkens Jul 15 '14 at 04:38
  • It would be one of the many things I've tried to see if it made any difference. But alas , it didn't. – Morris.C Jul 15 '14 at 04:46
  • Are you delimiting your strings with the single quote character (ie ') or a back-tick character (ie `). It needs to be single quote, and your code appears to be using back-tick. – Pieter Geerkens Jul 15 '14 at 04:49
  • 1
    Sorry guys, realised what the problem was. I'm using the wrong UPDATE syntax for PLSQL. – Morris.C Jul 15 '14 at 04:54
  • Please check this question as well: http://stackoverflow.com/questions/7030699/oracle-sql-update-with-data-from-another-table – sampathsris Jul 15 '14 at 04:58
  • 5
    If you found your solution, please add it as an answer and accept it to remove this question from the open questions list. – Sinkingpoint Jul 15 '14 at 05:29

0 Answers0