I had a stored procedure with no arguments which was invoked form the UNIX
script by db2 call
and the SP was working fine and script running fine as well.
The new requirement is to pass a file name to the stored procedure and do some
business logic -- I am not able to pass the file name from UNIX to the SP. I am using IN
parameter of Varchar(50)
.
The SP compiled fine and is available in the correct schema -- I invoked using multiple ways and none of them are working fine.
Please help me debug this.
DB2 Stored Procedure:
CREATE PROCEDURE ABC.sp_Update(IN FILE_NAME VARCHAR(50))
Different methods I tried Calling the DB2 stored proc from the UNIX script
db2 call "ABC.sp_Update("filename.txt")"
db2 call "ABC.sp_Update(("filename.txt"))"
FILE_NAME="filename.txt" db2 call "ABC.sp_Update($FILE_NAME)"
FILE_NAME="filename.txt" db2 call "ABC.sp_Update($(FILE_NAME))"
The error I get:
db2 call ABC.sp_Update(filename.txt)
SQL0206N "FILENAME.TXT" is not vali开发者_JAVA技巧d in the context where it
is used. SQLSTATE=42703
When I checked for the execution status of the command I get a return code 4
+ RC=4
Before the code change, this worked fine:
db2 call "ABC.sp_Update()"
When I Googled the description of the error 42703
, it is An undefined column, attribute, or parameter name was detected.
Sorry Guys - Should have used a single Quote - It worked - Thanks and sorry
精彩评论