USER DEFINED SQL FILE WITH DRS STAGE
Moderators: chulett, rschirm, roy
I tried changing the first argument from "UNIX" to "NT", and it didn't work. If I Test the routine, it just gets hanged.
I'm talking about the secong argument "InputArg" which you pass to the 'DSExecute'.
I think the format of this statement has been framed should be sightly different for executing it on Windows!
I'm talking about the secong argument "InputArg" which you pass to the 'DSExecute'.
Code: Select all
InputArg = "sqlplus":' ':USERNAME:'/':PASSWORD:'@':INSTANCE:' ':'@':PATH
Ok, I tried executing the same code with changing just the first argument from "UNIX" to "NT".
In the Director log, I get a warning message from the routine as "Error when executing command.". So looking into your code for that loop, it should have had a condition where 'SystemReturnCode' should have been something other than '0'.
Also, in the Director log, I see message returned after successfully getting connected to the database. So, the error is in the SQL statement part of it...
In the Director log, I get a warning message from the routine as "Error when executing command.". So looking into your code for that loop, it should have had a condition where 'SystemReturnCode' should have been something other than '0'.
Also, in the Director log, I see message returned after successfully getting connected to the database. So, the error is in the SQL statement part of it...
Try executing just this statement from your command line.
Code: Select all
sqlplus && USERNAME/PASSWORD @ INSTANCE @PATH
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson
The last part in building the 'InputArg' is the argument PATH.
In my case, I do need to substitute a SQL statement instead of a PATH where the SQL is available.
For example, you have provided it as
sqlplus <username>/<password>@<dbname> @ <PATH>
But, I want to execute it as,
sqlplus <username>/<password>@<dbname> @ SELECT COUNT(*) FROM DUAL;
When I try to executing with the above line as the 'InputArg', I get an error message that - SP2-0310: unable to open file "SELECT.sql"
So, instead of considering the last part as an SQL statement, it considers it as the file name that contains the SQL.
Please let me know how to overcome this.
Thanks.
In my case, I do need to substitute a SQL statement instead of a PATH where the SQL is available.
For example, you have provided it as
sqlplus <username>/<password>@<dbname> @ <PATH>
But, I want to execute it as,
sqlplus <username>/<password>@<dbname> @ SELECT COUNT(*) FROM DUAL;
When I try to executing with the above line as the 'InputArg', I get an error message that - SP2-0310: unable to open file "SELECT.sql"
So, instead of considering the last part as an SQL statement, it considers it as the file name that contains the SQL.
Please let me know how to overcome this.
Thanks.
Because you told it it was a file through the use of the '@' symbol. Try removing it and see what happens.vnspn wrote:So, instead of considering the last part as an SQL statement, it considers it as the file name that contains the SQL.
Not saying it will work, but worth a shot. Still think you are better scripting this in a 'here document' style so that errors can be properly captured. Your way, all you'll know is if you were able to get into sqlplus or not, errors generated by the sql itself won't be reported.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I tried removing the '@' symbol. The command that was passed to 'InputArg' would look like,
I tried printing the output of this in the Director log. It gets connected to the database, but the SQL command is not recognized after that. The output on the log looks like,
Code: Select all
sqlplus <username>/<password>@<dbname> SELECT COUNT(*) FROM DUAL;
SQL*Plus: Release 10.2.0.2.0 - Production
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Usage 1: sqlplus -H | -V
-H Displays the SQL*Plus version and the
usage help.
-V Displays the SQL*Plus version.
Usage 2: sqlplus [ [<option>] [<logon>] [<start>] ]
<option> is: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]
-C <version> Sets the compatibility of affected commands to the
version specified by <version>. The version has
the form "x.y[.z]". For example, -C 10.2.0
-L Attempts to log on just once, instead of
reprompting on error.
-M "<options>" Sets automatic HTML markup of output. The options
have the form:
HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
[ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
-R <level> Sets restricted mode to disable SQL*Plus commands
that interact with the file system. The level can
be 1, 2 or 3. The most restrictive is -R 3 which
disables all user commands interacting with the
file system.
-S Sets silent mode which suppresses the display of
the SQL*Plus banner, prompts, and echoing of
commands.
<logon> is: (<username>[/<password>][@<connect_identifier>] | /)
[AS SYSDBA | AS SYSOPER] | /NOLOG
Specifies the database account username, password and connect
identifier for the database connection. Without a connect
identifier, SQL*Plus connects to the default database.
The AS SYSDBA and AS SYSOPER options are database administration
privileges.
The /NOLOG option starts SQL*Plus without connecting to a
database.
<start> is: @<URL>|<filename>[.<ext>] [<parameter> ...]
Runs the specified SQL*Plus script from a web server (URL) or the
local file system (filename.ext) with specified parameters that
will be assigned to substitution variables in the script.
When SQL*Plus starts, and after CONNECT commands, the site profile
(e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile
(e.g. login.sql in the working directory) are run. The files may
contain SQL*Plus commands.
Refer to the SQL*Plus User's Guide and Reference for more information.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi Ray,
By "here script", do mean the one below,
I tried with this and it still didn't work. I printed the output of the command in the Director log. It is as below,
Thanks.
By "here script", do mean the one below,
Code: Select all
cmd = "sqlplus -s ":userID:"/":passWD:"@":dbName
cmd<-1> = "SELECT COUNT(*) FROM DUAL;"
cmd<-1> = "quit;"
Call DSExecute("NT",cmd,output,rc)
Is there a way we could resolve this?Error 45 initializing SQL*Plus
Internal error
DataStage/SQL: Table "DUAL" does not exist.
Verb "QUIT;" is not in your VOC.
Thanks.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: