Quote:
Originally Posted by sathyaram_s
It is not clear what you are trying to do in the stored procedure ? Can you post what you have already tried ?
What version of db2 are you on ?
|
Hi,
Sorry for the late reply.
I am able to achieve, what I was looking for after following these steps on dummy tables where I am declaring my column as Identity.
But, in my real scenario, clolumn in which I need to put values in a sequence is not declared as Identity column.
Here I am explaining what I have done for dummy tables:
CREATE PROCEDURE PRAP (IN YEAR CHAR(2), IN NUMBER CHAR (5))
LANGUAGE SQL
BEGIN
FOR i AS state CURSOR FOR SELECT DISTINCT STATE FROM FILE2
DO
INSERT INTO FILE1 VALUES (YEAR,NUMBER,DEFAULT,state);
END FOR;
END@
I create table FILE1 as :
CREATE TABLE FILE1 (YEAR CHAR(2), NUMBER CHAR(5),SEQ_NBR BIGINT NOT NULL GENERATED BY DEFAULT (START WITH 1 MINVALUE 1 NO CACHE)), STATE CHAR(3);
This is working, but when I am trying something like this on my existing table, it is not working for me.
Kindly suggest.