on ‎2017 Apr 05 5:31 AM
Dear Experts,
I have some scenarios where i have to run some sql queries dynamically , i went through many threads and found some useful and tried to use them but unfortunately i am still not done with this.
below is my code i want to execute
Regards,
Manish
drop procedure DNsql;
CREATE PROCEDURE DNsql (out Account nvarchar(200))
LANGUAGE SQLSCRIPT
AS
SQL1 nvarchar(200) := '';
BEGIN
create LOCAL TEMPORARY TABLE "#temp" (Accnt nvarchar(200));
SQL1:='insert into "#temp" SELECT 'SELECT'||' '||' '|| '"Account"' ||' '||'FROM'||' '||SCHEMA_NAME||'.'||'JDT1'
FROM schemas WHERE SCHEMA_NAME LIKE 'SBK%%%%'';
exec SQL1;
select Accnt into Account from "#temp";
DROP TABLE "#temp";
END;
Request clarification before answering.
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.