0

Hopefully this is a simple question. I want to write a shell script that calls a SQL script to do some queries in a Rocket UNIVERSE database. I am doing this from the Server command line (the same machine where the database resides).

In SQLSERVER I might do something like the following:

sqlcmd -S myServer\instanceName -i C:\myScript.sql

In Oracle like this:

SQL>@/dir/test.sql

In UV I can't figure it out:

uvsh ??? some.sql file

So in the test.sql file I might have something like the following:

"SELECT ID, COL1, COL2 FROM PRODUCT WHERE @ID=91;"
"SELECT ID, COL1, COL2 FROM PRODUCT WHERE @ID=92;"
"SELECT ID, COL1, COL2 FROM PRODUCT WHERE @ID=93;"

So can this be done or am I going about this the wrong way? Maybe a different method is more optimal? -- Thanks!

shawno
  • 343
  • 1
  • 3
  • 17

1 Answers1

0

You can send the list of commands to the UniVerse process with the following command.

C:\U2\UV\HS.SALES>type test.sql | ..\bin\uv

You will not need the '"' around each statement you described.

For the HS.SALES account the following SQL commands should work:

SELECT @ID, FNAME, LNAME FROM CUSTOMER WHERE @ID='2';
SELECT @ID, FNAME, LNAME FROM CUSTOMER WHERE @ID='3';
SELECT @ID, FNAME, LNAME FROM CUSTOMER WHERE @ID='4';

Note that this may not do what you want, this will display the results to standard out. Also, caution should be taken when sending commands to UniVerse in this manner. If all of the UniVerse licenses are in use the uv command will fail, and the SQL commands will never execute.

Mike
  • 194
  • 11
  • Thanks for your response! My apologies for not being more specific. I am on AIX. The datafiles are in /u2/eclipse. The uv command is in /u2/uv/bin/uv; though if you just type "uv" from within /u2/eclipse you get the UV command prompt. So when I input the following from /u2/eclipse: "type /home/user_dir/test1.sql | uv" I get the following: >Program "UPDATE.LOGIN.INFO" Line 26, Improper data type. – shawno Jan 24 '15 at 22:49
  • You are trying to call the Eclipse account directly. You can avoid this error by calling the uv account. – Jon Sep 07 '16 at 18:16