Question : Oracle Error "To many precesion Specifiers"

I have two different scripts running that update a table.
Table:
UPdateNum UpdateDate Value1 Value2

The scripts were planned to ...

SCRIPT1
Check if todays date exists in the table and
IF YES UPDATE VALUE1 not interupting any other column in that Record
IF NO  INSERT sysdate into UpdateDate and calculated number into Value1 leaving Value2 NULL

SCRIPT2
Check if todays date exists in the table and
IF YES UPDATE VALUE2 not interupting any other column in that Record
IF NO  INSERT sysdate into UpdateDate and calculated number into Value2 leaving Value1 NULL

So by running both scripts i shd get the record populated by value 1 and 2 and still retaining 1 record per DATE

BUt.......

I get an error saying that "To many precesion Specifiers"

I executed parts of SQL and identiied that error is in UPDATE BLOCK of my CODE given below

Anyhelp wud be greatly appreciated.

:)


Im on Oracle 10g Enterprise
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
-- CODE from SCRIPT 1
UPDATE SALES
   SET EMP_MGR_TOTAL_CHNAGES = total 
   WHERE TRUNC(UPDATEDATE, 'MM/DD/YYYY') = TRUNC(sysdate, 'MM/DD/YYYY');
   
      IF SQL%ROWCOUNT = 0  THEN  -- no update
      INSERT INTO SALES
   (UPDATENUM,UPDATEDATE,EMP_MGR_TOTAL_CHANGES,EMP_TERM_TOTAL_CHNAGES)
   VALUES
   (SALES.UPDATENUMSEQ.NEXTVAL,SYSDATE,total,NULL);
  END IF;



-- CODE from SCRIPT 2
UPDATE SALES
   SET EMP_TERM_TOTAL_CHNAGES = total 
   WHERE TRUNC(UPDATEDATE, 'MM/DD/YYYY') = TRUNC(sysdate, 'MM/DD/YYYY');
   
      IF SQL%ROWCOUNT = 0  THEN  -- no update
      INSERT INTO SALES
   (UPDATENUM,UPDATEDATE,EMP_MGR_TOTAL_CHANGES,EMP_TERM_TOTAL_CHNAGES)
   VALUES
   (SALES.UPDATENUMSEQ.NEXTVAL,SYSDATE,NULL,total);
  END IF;

Answer : Oracle Error "To many precesion Specifiers"

I've already said this:  You cannot use a format mask with a date trunc!

"TRUNC(UPDATEDATE, 'MM/DD/YYYY')" IS NOT ALLOWED... PERIOD.

change the original code you posted to:
...
WHERE TRUNC(UPDATEDATE) = TRUNC(sysdate);
...
Random Solutions  
 
programming4us programming4us