Toad World® Forums

Rowcount


#1

I have a simple update that seems to failing. The syntax is right, I think. Here it is: Need help, please.


#2

Looks like you forgot to post the update, or you have an image you posted that is not displaying.


#3

Looks like the image I had is not displaying.

Here is a snippet of the code. Failing at the SET Rowcount 0 line.

DECLARE ROWCOUNT INTEGER;
begin
SET ROWCOUNT 0;

SELECT COUNT(Style_CD)
INTO ROWCOUNT
FROM Admin_pca_style
WHERE Style_CD = ‘STRIPES’;

IF ROWCOUNT = 0
THEN
INSERT INTO Admin_pca_style(Style_CD, Style_Desc, Active_ind, Background_Img, Award_Stock, Order_Stock, Modify_DT, Modify_User_id, Default_ind, pca_ind, Custom_ind, Web_Display_Format, msg_length_limit, msg_line_limit) VALUES(‘STRIPES’,‘Pivoting Stripes’,‘N’,‘STRIPES.JPG’,‘STRIPES_AWARD’,‘STD2010_ORDER’,SYSDATE,‘SYSTEM’,‘N’,‘Y’,‘N’,‘PCA2017_Left.caml’,500,8);
END IF;
END;
begin
SET ROWCOUNT 0


#4

How about

BEGIN

INSERT INTO Admin_pca_style(Style_CD, Style_Desc, Active_ind, Background_Img, Award_Stock, Order_Stock, Modify_DT, Modify_User_id, Default_ind, pca_ind,
Custom_ind, Web_Display_Format, msg_length_limit, msg_line_limit)
SELECT ‘STRIPES’,‘Pivoting Stripes’,‘N’,‘STRIPES.JPG’,‘STRIPES_AWARD’,‘STD2010_ORDER’,SYSDATE,‘SYSTEM’,‘N’,‘Y’,‘N’,‘PCA2017_Left.caml’,500,8 FROM DUAL
WHERE NOT EXISTS (SELECT STYLE_CD FROM Admin_pca_style WHERE Style_CD = ‘STRIPES’ AND ROWCOUNT = 1);

END;