Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Help : simple PL/SQL question
DECLARE
CURSOR my_cursor IS SELECT PRICE,PROD_ID FROM PRODUCT; I_IDENTIF VARCHAR2(80); // exactly the same data type as PROD_ID I_PRIX NUMBER(18,2); // exactly the same data type asPRICE BEGIN OPEN my_cursor;
LOOP FETCH my_cursor INTO I_PRIX,I_IDENTIF; UPDATE PRODUCT SET PRICE_ENTIER=(I_PRIX*100) WHERE PROD_ID='I_IDENTIF'; EXIT WHEN (my_cursor%ROWCOUNT > 666) OR (my_cursor%NOTFOUND) ; COMMIT; END LOOP; CLOSE my_cursor;
END;
I get "PL/SQL procedure successfully completed." as a result of
executing this script.
But nothing (PRICE_ENTIER) is updated in the PRODUCT table...I've been
spending time looking at this query and I can't see the error...
I_IDENTIF (which is supposedly updating my ID field) is of VARCHAR type
(sounds very strange but I didn't do the database schema myself).
PRICE_ENTIER is a NUMBER(38).
In fact, through the script, I'm converting values from NUMBER(18,2)
type to NUMBER(38), to get rid of my decimals...
Received on Tue May 16 2000 - 00:00:00 CDT
![]() |
![]() |