P. 1
Supplier Save

Supplier Save

|Views: 2|Likes:
Published by vinod_kumar_147
data modeling
data modeling

More info:

Published by: vinod_kumar_147 on May 26, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

05/26/2013

pdf

text

original

PROCEDURE SP_SAVE_SUPPLIER_DTLS(P_SUPLR_DTLS_XML_IN IN XMLTYPE, P_RESULT_OUT OUT NUMBER, P_MSG_OUT OUT VARCHAR2) IS L_SUPPLIER_CONFIG_ID RAAV_SUPPLIER_CONFIG.

SUPPLIER_CONFIG_ID%TYPE; BEGIN FOR I IN (SELECT (EXTRACTVALUE(VALUE(P), '/Supplier/SupplierId/text()')) SUPPLIERID, (EXTRACTVALUE(VALUE(P), '/Supplier/Scope/text()')) SCOPE, (EXTRACTVALUE(VALUE(P), '/Supplier/GroupId/text()')) GROUPID, (EXTRACTVALUE(VALUE(P), '/Supplier/CreationID/text()')) CREATIONID, (EXTRACTVALUE(VALUE(P), '/Supplier/LastUpdateID/text()')) LASTUPDATEID, (EXTRACTVALUE(VALUE(P), '/Supplier/ApplicationId/text()')) APPLICATIONID, (EXTRACTVALUE(VALUE(P), '/Supplier/ApplicationURL/text()')) APPLICATIONURL, (EXTRACTVALUE(VALUE(P), '/Supplier/CustomerTypeCode/text()')) CUSTOMERTYPECODE, (EXTRACTVALUE(VALUE(P), '/Supplier/EncryptionOption/text()')) ENCRYPTIONOPTION, EXTRACT(COLUMN_VALUE, '/Supplier/Fields/SupplierField') SUPPLIERFIELDS FROM TABLE(XMLSEQUENCE(P_SUPLR_DTLS_XML_IN.EXTRACT('/Supplier'))) P) LOOP IF I.SUPPLIERID = 0 THEN INSERT INTO RAAV_SUPPLIER_CONFIG (SUPPLIER_CONFIG_ID, APP_ID, APP_URL, SCOPE, GROUP_ID, CUST_TYPE_CD, ENCRPTN_IND, CRTN_ID, CRTN_DT_TM, LAST_UPDT_ID, LAST_UPDT_DT_TM) VALUES (SUPPLIER_CONFIG_ID_SEQ.NEXTVAL, I.APPLICATIONID, I.APPLICATIONURL, I.SCOPE, I.GROUPID, I.CUSTOMERTYPECODE, DECODE(I.ENCRYPTIONOPTION, 'PlainText', 'P', 'Encrypted', 'E'), I.CREATIONID, SYSDATE, I.LASTUPDATEID, SYSDATE) RETURNING SUPPLIER_CONFIG_ID INTO L_SUPPLIER_CONFIG_ID; FOR J IN (SELECT EXTRACTVALUE(COLUMN_VALUE, '/SupplierField/FieldId') FIELD_ID, EXTRACTVALUE(COLUMN_VALUE, '/SupplierField/QueryStringName') QUERY_STRNG_NM FROM TABLE(XMLSEQUENCE(I.SUPPLIERFIELDS.EXTRACT('SupplierField')))) LOOP INSERT INTO RAAV_SUPPLIER_CONFIG_ATTRB (SUPPLIER_CONFIG_ID, ATTRB_ID, QUERY_STRING_NAME, CRTN_ID, CRTN_DT_TM, LAST_UPDT_ID, LAST_UPDT_DT_TM) VALUES (L_SUPPLIER_CONFIG_ID,

'P'.LASTUPDATEID. LAST_UPDT_ID = I.CREATIONID. DELETE FROM RAAV_SUPPLIER_CONFIG_ATTRB WHERE SUPPLIER_CONFIG_ID = I.APPLICATIONURL.LASTUPDATEID.SUPPLIERFIELDS.EXTRACT('SupplierField')))). I.LASTUPDATEID. 'Encrypted'.SUPPLIERID. CUST_TYPE_CD = I. '/SupplierField/FieldId') FIELD_ID FROM TABLE(XMLSEQUENCE(I.ENCRYPTIONOPTION.J.CREATIONID.FIELD_ID. J. EXTRACTVALUE(COLUMN_VALUE. QUERY_STRING_NAME. I. ENCRPTN_IND = DECODE(I. LAST_UPDT_DT_TM) (SELECT I.QUERY_STRNG_NM.APPLICATIONID. '/SupplierField/FieldId') FIELD_ID.SUPPLIERFIELDS. I. 'PlainText'.EXTRACT('SupplierField'))) X WHERE NOT EXISTS (SELECT 1 FROM RAAV_SUPPLIER_CONFIG_ATTRB B WHERE B. GROUP_ID = I. SYSDATE FROM TABLE(XMLSEQUENCE(I. SCOPE = I.QUERY_STRING_NAME = (SELECT EXTRACTVALUE(COLUMN_VALUE.ATTRB_ID = . '/SupplierField/QueryStringName') QUERY_STRNG_NM FROM TABLE(XMLSEQUENCE(I.SUPPLIERID. UPDATE RAAV_SUPPLIER_CONFIG_ATTRB A SET A.EXTRACT('SupplierField'))) WHERE EXTRACTVALUE(COLUMN_VALUE. SYSDATE.SUPPLIER_CONFIG_ID = I. 'E').GROUPID. '/SupplierField/QueryStringName') QUERY_STRNG_NM. CRTN_ID. SYSDATE. SYSDATE).SUPPLIERID AND ATTRB_ID NOT IN (SELECT EXTRACTVALUE(COLUMN_VALUE. LAST_UPDT_ID. ELSE UPDATE RAAV_SUPPLIER_CONFIG SET APP_ID = I. INSERT INTO RAAV_SUPPLIER_CONFIG_ATTRB (SUPPLIER_CONFIG_ID. CRTN_DT_TM. ATTRB_ID. END LOOP.SUPPLIERFIELDS. LAST_UPDT_DT_TM = SYSDATE WHERE SUPPLIER_CONFIG_ID = I.CUSTOMERTYPECODE.ATTRB_ID) WHERE A. I.SCOPE. '/SupplierField/FieldId') = A.SUPPLIERID. EXTRACTVALUE(COLUMN_VALUE. APP_URL = I.

P_RESULT_OUT := 1. '/SupplierField/FieldId') AND B. END SP_SAVE_SUPPLIER_DTLS. END LOOP.EXTRACTVALUE(COLUMN_VALUE. EXCEPTION WHEN OTHERS THEN null. COMMIT.SUPPLIER_CONFIG_ID = I. P_MSG_OUT := NULL.SUPPLIERID)). END IF. .

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->