DB2 on Windows V9.1
the stored procedure (below) was created specifically to
CALL SYSPROC.ADMIN_CMD ('IMPORT FROM NUL OF DEL REPLACE INTO MYTABLE')
but we are getting this error:
DB2 Database Error: ERROR [] [IBM][DB2/NT] SQL3015N An SQL error "-444" occurred during processing.
I cannot find SQL3015N (code 444) - does anyone know how we can pass 'IMPORT FROM NUL OF DEL REPLACE INTO MYTABLE in a stored procedure?
CREATE PROCEDURE KCDWHUAT.truncate_table(IN sch_name VARCHAR(130),IN tab_name VARCHAR(130))
LANGUAGE SQL
BEGIN
DECLARE stmt VARCHAR(1000);
DECLARE param VARCHAR(1000);
DECLARE full_name VARCHAR(1000);
DECLARE a VARCHAR(130);
IF sch_name IS NULL
THEN
SET full_name = tab_name;
SELECT tabname INTO a FROM SYSCAT.TABLES WHERE tabname = UCASE(tab_name);
ELSE
SET full_name = sch_name||'.'||tab_name;
SELECT tabname INTO a FROM SYSCAT.TABLES WHERE tabname = UCASE(tab_name) AND tabschema = UCASE(sch_name);
END IF;
IF UCASE(a) = UCASE(tab_name)
THEN
SET param = 'IMPORT FROM NUL OF DEL REPLACE INTO '||full_name;
SET stmt = 'CALL SYSPROC.ADMIN_CMD (?)';
PREPARE s1 FROM stmt;
EXECUTE s1 USING param;
ELSE
END IF;
END
the stored procedure (below) was created specifically to
CALL SYSPROC.ADMIN_CMD ('IMPORT FROM NUL OF DEL REPLACE INTO MYTABLE')
but we are getting this error:
DB2 Database Error: ERROR [] [IBM][DB2/NT] SQL3015N An SQL error "-444" occurred during processing.
I cannot find SQL3015N (code 444) - does anyone know how we can pass 'IMPORT FROM NUL OF DEL REPLACE INTO MYTABLE in a stored procedure?
CREATE PROCEDURE KCDWHUAT.truncate_table(IN sch_name VARCHAR(130),IN tab_name VARCHAR(130))
LANGUAGE SQL
BEGIN
DECLARE stmt VARCHAR(1000);
DECLARE param VARCHAR(1000);
DECLARE full_name VARCHAR(1000);
DECLARE a VARCHAR(130);
IF sch_name IS NULL
THEN
SET full_name = tab_name;
SELECT tabname INTO a FROM SYSCAT.TABLES WHERE tabname = UCASE(tab_name);
ELSE
SET full_name = sch_name||'.'||tab_name;
SELECT tabname INTO a FROM SYSCAT.TABLES WHERE tabname = UCASE(tab_name) AND tabschema = UCASE(sch_name);
END IF;
IF UCASE(a) = UCASE(tab_name)
THEN
SET param = 'IMPORT FROM NUL OF DEL REPLACE INTO '||full_name;
SET stmt = 'CALL SYSPROC.ADMIN_CMD (?)';
PREPARE s1 FROM stmt;
EXECUTE s1 USING param;
ELSE
END IF;
END