473,396 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Execute immediate error

My SP :

create procedure ARUN.CREATE_TABLE(in schema_name varchar(25),
in tab_name varchar(25),in tgt_schema_name varchar(25), in
tgt_tab_name varchar(25),in tgt_ts_name varchar(25), in tgt_ix_name
varchar(25))
SPECIFIC CREATABEL
MODIFIES SQL DATA EXTERNAL ACTION DETERMINISTIC
begin
declare TXT varchar(100);
for TXT AS
select ddltext from db2admin.ddllog_3
do
begin
insert into db2admin.ddllog_2 (ddltext) values(TXT);
--execute immediate TXT;
end;
end for;
end ;

Just selecting from one table and inserting into another, all I get is
null in the target table. Does Varchar have something to do in this
issue? This is driving me mad!! Please help...

As far as datatypes are concerned , they all are varchar(100)..
the only data i have in target is the foll 2 rows .

DB2ADMIN
DB2
Feb 19 '08 #1
2 1409
Yes Dave. This was a test SP for a bigger requirement. I tried out the
changed for loop construct that you have supplied.

Instead of
for <>
do
begin
end
end for;

I changed to
for <>
do begin
end for;

It gave me syntax error on creation. Apparantly , every begin needs an
end statement, so before end for, it needs an end ;
The thing that scared me was that when I used cursor logic, with loop
statement, all statements got executed fine...

declare cur1 cursor for <>
open cur1;
lp1:
loop
while <>
..
..
end loop lp1;

but when I used the above logic (with the extra end statement), all I
got in the TXT was a 'null' value. We use that method in some other
procedures and I have to check the data against their run, since the
null may affect the required data, even though they complete fine..

Arun
Feb 19 '08 #2
I found the answer. Thanks again...

Arun
Feb 20 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: michi | last post by:
Hello there... Can anybody tell me what is the difference when I excecute a sql statement within pl sql with/without "execute immediate" statement Thanks Michi :)
4
by: finlma | last post by:
I'm trying to run an EXECUTE IMMEDIATE within a PL/SQL if loop but it doesn't work for me. I'm trying to create a column conditionally but it doesn't work. It fails because there are apostrophes...
5
by: Gustavo Randich | last post by:
Hello, I'm writing an automatic SQL parser and translator from Informix to DB2. Now I'm faced with one of the most difficult things to translate, the "foreach execute procedure" functionality...
0
by: vijay | last post by:
hai every bady.. this is vijay from india. I want execute "shutdown immediate" command on oracle database from perl script. I was trying to execute through connect(), prepare() & execute()..But It's...
1
by: lakon15 | last post by:
Dear all, I'll try to convert from SQL server Store Procedure to DB2 Store Procedure. I've make SP under DB2 like this CREATE PROCEDURE GetSearchedRecords (pKeyWords VARCHAR(1000), ...
5
by: umesh049 | last post by:
Hello, I want to delete all the date of all the table in a scheman. but i got error at execute immediate statement. can any body help me. thanks
3
by: nghivo | last post by:
My environment DB2 9.1.4 on Sun OS I write a C embedded SQL to load data. I declare host vars as: EXEC SQL BEGIN DECLARE SECTION; SQL TYPE IS CLOB(599999) sqlStr; EXEC SQL END DECLARE...
3
by: Rahul Babbar | last post by:
Hi, I have the following doubt. Suppose I use the execute immediate statement and the statement to be executed is a Select statement from the sysibm.sysdummy1 table which will always return...
5
by: stmfc | last post by:
i dont know why pl/sql block below returns no data found error. do you have any idea about it? declare c1 varchar2(80); c2 varchar2(80); begin execute immediate 'select col2 from table1 where...
6
by: Oliver | last post by:
I'm fairly new to DB2. I have been assigned to build a delete trigger that finds the data type of each of the table's fields so that the trigger can then build a string consisting of OLD values...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.