hi

i am creating stored procedure using cursors, i am using two cursors in my procedure, i takes the two fields in one table that fields are stored first cursor, and second table fields are stored in second cursor, and i check the condition for first table one field is equal to second table one field in if loop, the condition is matches the all field insert in one table other wise all field is insert into one table


the if condition cannot be executed?

help me

my procedure is:

create or replace
PROCEDURE PRODUCTSUMMA AS
TYPE RECORD IS REF CURSOR;
CURI RECORD;
CURP RECORD;
NAME VARCHAR(400):=NULL;
DESC1 VARCHAR(400):=NULL;
DESC2 VARCHAR(400):=NULL;
PRODUCTID NUMBER:=NULL;
itemid number:=null;
PRODUCTNAME VARCHAR(40):=NULL;
BEGIN

FOR CURI IN
(select shortdesc||' '||ean||' '||'('||UNSPC||')' as name, itemid from item where classid not like '20%' and orgin<>'Sale' and entityid='VAISHNAVI' AND ean is not null)
LOOP
DESC1:=CURI.NAME;
itemid:=curi.itemid;

FOR CURP IN
(SELECT M_PRODUCT_ID,NAME FROM M_PRODUCT WHERE PRODUCTTYPE='I' and ad_client_id=1000001)
LOOP
DESC2:=CURP.NAME;
productid:=curp.m_product_id;

IF(DESC1=DESC2)
THEN
INSERT INTO TEMP_PRODUCT(ITEMID,M_PRODUCT_ID,NAME) VALUES(CURI.ITEMID,CURP.M_PRODUCT_ID,CURP.NAME);
ELSE
INSERT INTO UNMATCHPRODUCT(ITEMID,M_PRODUCT_ID,NAME) VALUES(CURI.ITEMID,CURP.M_PRODUCT_ID,CURP.NAME);
END IF;


END LOOP;
END LOOP;

END ;

Recommended Answers

All 4 Replies

what is the problem with IF ?

my problem is the if condition cannot be executed


thanks

is that throwing any error ?

no error is occured, is my procedure is correct or not?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.