Query a DB from another DB in ksh


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Query a DB from another DB in ksh
# 1  
Old 08-24-2007
Query a DB from another DB in ksh

I'm trying to connect to a DB on a windows server from a DB on a unix server. While I can connect, I can't seem to get the expected results back, I'm only getting the number "2" back no matter what date I put in (I should be getting "408" or "410" depending on the date). Funny, when I go into Q-engine and run the statement I *do* get back the results I expect. Here is what I'm trying (by the way, I *am* switching the user to the UNIX DB owner first) and how the result looks:

sqlplus /

connect windowsDBUSER/windowsDBPASS@windowsDBNAME
Connected

SQL> select count(*) from tablename where transdate='22-Jul-2007'
2

Thanks for any help you can offer!
# 2  
Old 09-16-2007
What if you try this:

SQL> select * from tablename where transdate='22-Jul-2007'

What records do you get back? Maybe this will help you trace the problem.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Asign to variable ksh some values of sql query

Hi, I'm trying to asign to ksh varible some values of a sql query. The output query would be: xxxx 1 yyyy 2 I do: values=`$PATH_UTI/query_sh " select think1||'------'||think2 from some_table where think3 = '$1'; ... (2 Replies)
Discussion started by: mierdatuti
2 Replies

2. UNIX for Dummies Questions & Answers

Extract only the data from ksh script running netezza query

Hi I searched this forum before posting the question, but couldnt find it, the issue i'm facing is, i'm trying to select a column from a netezza table from a korn shell script, but the query runs var=$(nzodbcsql -q "select MAX(millcount) from table1";) echo $var it returns the value like... (10 Replies)
Discussion started by: maximus_jack
10 Replies

3. Shell Programming and Scripting

Shell Script (ksh) - SQLPlus query filter using a string variable

Using ksh, I am using SQLPlus to execute a query with a filter using a string variable. REPO_DB=DEV1 FOLDER_NM='U_nmalencia' FOLDER_CHECK=$(sqlplus -s /nolog <<EOF CONNECT user/pswd_select@${REPO_DB} set echo off heading off feedback off select subj_name from subject where... (5 Replies)
Discussion started by: nkm0brm
5 Replies

4. Shell Programming and Scripting

Beginner in ksh - umask query

I started to learn KSH I am doing some exercises from the book $ umask =rx, u+w $ print Keep track of everythine > file1.out $ print Be careful >> file1.out ksh: file1.out: cannot create $ umask -S ... (1 Reply)
Discussion started by: solaris_user
1 Replies

5. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

6. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

7. Shell Programming and Scripting

to find whether update query is successfull or not using Ksh Script

i have a script that performes an update operation. I just wanted to know whether that update statement is successfull or not. Below the script: #!/bin/ksh . $HOME/conf/systemProperties/EnvSetup.properties sqlplus -silent sie/da@edn.world <<END set pagesize 0 feedback off verify off... (3 Replies)
Discussion started by: ali560045
3 Replies

8. Shell Programming and Scripting

Query regarding ksh

I wrote a script in ksh as follow: echo "Hello" if ; then echo "bye" else echo "Welcome" fi i ran this script two time with different syntax like this: ~/my_temp > ./test.ksh Hello bye ~/my_temp > test.ksh WIDTH: 12 WIDTH: 17 RELEASE (4 Replies)
Discussion started by: vaibhav
4 Replies

9. Shell Programming and Scripting

passing result of query to a varibale in ksh script

Hi, I have a scenario where in i have to extarct max of one column and pass it to a variable. i have tried to export the result as .dat file and read from that file.But my database is mainframe and it is not permitting me to export in .dat file.I have tried using .ixf file but reading from... (2 Replies)
Discussion started by: ammu
2 Replies

10. Shell Programming and Scripting

KSH n FTP query

Hi, I have this slightly modified FTP code (thanks to this forum) function gather_FTPDate { HOST= USER= PASSWD= exec 4>${TEMP_LOG_FILE} ftp -nv >&4 2>&4 |& echo $? if ] then echo "Unable to connect to FTP server!!!" >> ${LOG_FILE} return 0 fi print -p open... (2 Replies)
Discussion started by: psynaps3
2 Replies
Login or Register to Ask a Question