Hi, calling sql query from a routine using sqlplus. routine run never ending.
Code:
Statement = "SELECT count(*) FROM TableName;"
Command = "sqlplus -S ": pSrcDBUser : "/" : pSrcDBPwd : pConString : char(10) : "SELECT count(*) FROM TableName;" : char(10) : "Exit" : char(10)
Call DSExecute ('NT', Command, OsOutput, OsStatus)
Above command will look before calling dsexecute as:
sqlplus -S UserName/Pwd@ConString
SELECT count(*) FROM TableName;
Exit
when I ran this directly from command prompt it is working fine and resulting record count. But when i call through DSExecute it is never ending the execution. I tried below as well but no luck. Please help.
Command = "sqlplus -S ": pSrcDBUser : "/" : pSrcDBPwd : pConString : char(10) : "SELECT count(*) FROM TableName;" : char(10) : "Exit" : char(10) : "Exit" : char(10)
Thanks in advance
Sqlplus cmd not returning control back to Routine
Moderators: chulett, rschirm, roy
Sqlplus cmd not returning control back to Routine
Last edited by maks475 on Fri Jun 26, 2015 1:44 am, edited 1 time in total.
Re: Sqlplus cmd not returning control back to Routine
OsOutput will store the return value of query. You need to map this to another variable.
like
QueryResult = TRIM(FIELD,OsOutput,@FM,3))
YOu can pass this value to log
Call DSLogInfo("Result:":QueryResult, "JobStats")
like
QueryResult = TRIM(FIELD,OsOutput,@FM,3))
YOu can pass this value to log
Call DSLogInfo("Result:":QueryResult, "JobStats")
Re: Sqlplus cmd not returning control back to Routine
Did you do this using the same user that executes the job?maks475 wrote:when I ran this directly from command prompt it is working fine
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers