Hi Experts,
I have created a stored procedure wherein it takes input as Table name, column name, data type and length, constraints and primary key and generates SQL scripts automatically.
I am able to successfully create the create scripts. But I am not able to catch the exceptions. Ex : input has 2 same columns for a table. So it must give an exception that duplicate column for a table. When I debug the SP, the control is not all going to Declare Exit handler statement and directly exiting the sp. Please help .
Please find the details of SP attached.
Below are the input to the SP.
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A11','B1','INTEGER','Mandatory','FALSE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('B11','B1','NVARCHAR(10)','Required','FALSE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A12','B4','SECONDDATE','Required','FALSE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A13','B3','NVARCHAR(10)','FALSE','FALSE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A12','B5','DATE','Mandatory','TRUE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A11','B2','INTEGER','Mandatory','TRUE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A12','B6','INTEGER','Mandatory','TRUE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A11','B3','INTEGER','Mandatory','FALSE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A12','B7','SECONDDATE','Required','FALSE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('A13','B4','NVARCHAR(10)','Mandatory','TRUE');
INSERT INTO "SREELATR"."CREATEDATA" VALUES ('B11','B4','NVARCHAR(10)','Mandatory','TRUE');
Output of SP : CREATE COLUMN TABLE sreelatr.createsqloutput (CREATOUTPUT NVARCHAR(5000));