Question : Execute Immediate


I am getting error when I concatenating the 'User' with the substring. Can someone suggest the syntax for inserting using exec immediate
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
EXECUTE IMMEDIATE
          'INSERT INTO membership(pid,
                                 lname,
                                 fname,
                                 dob,
                                 gender,
                                 insertedby,
                                 insertdatetime,
                                 runid)
                         VALUES (l_seq,
                                 'User'||substr(lpad(abs(l_seq),9,0),-5),

                                 'Test'||substr(lpad(abs(l_seq),9,0),-5),
                                 i.dob,
                                 i.gender,
                                 1,
                                 SYSDATE,
                                 l_runid)';

Answer : Execute Immediate

Missed some.... (I probably will as well)

EXECUTE IMMEDIATE
'INSERT INTO membership(pid,
lname,
fname,
dob,
gender,
insertedby,
insertdatetime,
runid)
VALUES (l_seq,
''User'''||substr(lpad(abs(l_seq),9,0),-5) ||
''',Test''||substr(lpad(abs(l_seq),9,0),-5) ||
''', '
i.dob,
i.gender,
1,
SYSDATE,
l_runid)';
Random Solutions  
 
programming4us programming4us