Sponsored Content
Full Discussion: Oracle SQL Query & connect?
Top Forums Shell Programming and Scripting Oracle SQL Query & connect? Post 302340373 by panyam on Monday 3rd of August 2009 09:30:21 AM
Old 08-03-2009
Test it once , i am sure you will understand .

otherwise :

Code:
echo "set head off
set echo off
set feedback off
select  name   from test1;" | sqlplus  -s "username/password"  | sed '/^$/d' | while read line
do
echo "displayed " $line |sed s/!//g
done


Last edited by panyam; 08-03-2009 at 10:40 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

& in SQL query

I have a script that looks for all jobs that contain a particular calendar. Some of the calendars have '&' in them and sql freaks out when it encounters that.. is there a way around this? I have tried: select job_name from job where run_calendar='1&15dom' select job_name from job... (3 Replies)
Discussion started by: Lindarella
3 Replies

2. Shell Programming and Scripting

Different way to connect to database ans execute sql query

Hi Friends, I am using AIX version and sqlplus to connect to database while writing a shell script. I have implemented three ways to connect to database : 1) sqlplus -s <USERNAME>/<PASSWORD> <<! @<SQL FILE TO EXECUTE> exit ! 2) sqlplus -s <USERNAME>/<PASSWORD> <<! -----sql statemenets... (6 Replies)
Discussion started by: gauravgarg
6 Replies

3. UNIX for Advanced & Expert Users

Extract Oracle DB Connect and SQL execution log

Hi, I am trying to write a generic script as a part of a framework which will establish Oracle DB connection once and loops in to check for some files which gives the SQL statements to execute. The script is running but I am stuck with capturing errors ( ORA and SP) and outputs. Example: ... (4 Replies)
Discussion started by: mirage0809
4 Replies

4. UNIX for Dummies Questions & Answers

bash script & sql query

Hi Guys, I would like with this script "DATA=`ora123 su -c 'echo "SET HEADING OFF;\n SET FEED OFF;\n select USER NAME, ACCOUNT_STATUS from dba_users;\n exit" | sqlplus / as sysdba -s /' ` echo $DATA >> $DAT" make a sql query, but the statement "select USER NAME, ACCOUNT_STATUS from... (6 Replies)
Discussion started by: ixibits
6 Replies

5. Shell Programming and Scripting

Read value from user and use it in Oracle SQL query

Guys can anyone just tell me whether i can pass a value(from UNIX SCRIPT) as an ARGUMENT in Oracle Query? e.g. echo "enter value" read value insert into tablename where col=$value /*something like this*/ (1 Reply)
Discussion started by: subodh.thakar
1 Replies

6. Shell Programming and Scripting

perl- oracle sql query

Hi, I am new to perl.How to query oracle database with perl??? Thanks (1 Reply)
Discussion started by: tdev457
1 Replies

7. Shell Programming and Scripting

How to run a SQL select query in Oracle database through shell script?

I need to run a SQL select query in Oracle database and have to capture the list of retrieved records in shell script. Also i would like to modify the query for certain condition and need to fetch it again. How can i do this? Is there a way to have a persistent connection to oracle database... (9 Replies)
Discussion started by: vel4ever
9 Replies

8. Shell Programming and Scripting

Korn Script to connect and query oracle database

I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error: ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
Discussion started by: jackmorgan2007
2 Replies

9. UNIX for Dummies Questions & Answers

Removing unnecessary eol ($) character from Oracle sql query output

Hi All, I am fetching oracle query result in shell variable. As columns numbers are more the output wraps in unix terminal .i.e one complete record in db gets store in multiple lines. with each line ends with $ character. I want to remove these unnecessary $ character but to keep required $... (8 Replies)
Discussion started by: Harshal22
8 Replies

10. Programming

Oracle simple SQL query result in: ORA-08103: object no longer exists

Dear community, please help with a query on Oracle. I'm using SQLPlus (but with SQLDeveloper is the same) to accamplish a sinple query like: select count(*) from ARCHIT_D_TB where (TYP_ID=22 OR TYP_ID=23) and SUB_TM like '%SEP%' and CONS=1234This is a very simple query that works perfect until... (5 Replies)
Discussion started by: Lord Spectre
5 Replies
grass-odbc(1grass)						Grass User's Manual						grass-odbc(1grass)

NAME
grass-odbc - ODBC driver ODBC driver ODBC driver in GRASS Communication between GRASS and ODBC database for attribute management: | GRASS module | | ODBC Interface | | RDBMS | GRASS | DBMI driver | unixODBC | ODBC driver | PostgreSQL | Oracle | ... Supported SQL commands All SQL commands supported by ODBC. Operators available in conditions All SQL operators supported by ODBC. EXAMPLE
In this example we copy the dbf file of a SHAPE map into ODBC, then connect GRASS to the ODBC DBMS. Usually the table will be already present in the DBMS. Configure ODBC driver for selected database (manually or with 'ODBCConfig'). ODBC drivers are defined in /etc/odbcinst.ini. Here is example: [PostgreSQL] Description = ODBC for PostgreSQL Driver = /usr/lib/libodbcpsql.so Setup = /usr/lib/libodbcpsqlS.so FileUsage = 1 Create DSN (data source name). The DSN is used as database name in db.* modules. Then DSN must be defined in $HOME/.odbc.ini (for this user only) or in /etc/odbc.ini for (for all users) [watch out for the database name which appears twice and also for the PostgreSQL protocol version]. Omit blanks at the beginning of lines: [grass6test] Description = PostgreSQL Driver = PostgreSQL Trace = No TraceFile = Database = grass6test Servername = localhost UserName = neteler Password = Port = 5432 Protocol = 8.0 ReadOnly = No RowVersioning = No ShowSystemTables = No ShowOidColumn = No FakeOidIndex = No ConnSettings = Configuration of an DSN without GUI is described on http://www.unixodbc.org/odbcinst.html, but odbc.ini and .odbc.ini may be created by the 'ODBCConfig' tool. You can easily view your DSN structure by 'DataManager'. Con- figuration with GUI is described on http://www.unixodbc.org/doc/UserManual/ To find out about your PostgreSQL protocol, run: psql -V Now create a new database if not yet existing: db.createdb driver=odbc database=grass6test Now store the table 'mytable.dbf' (here: in current directory) into PostgreSQL through ODBC: db.connect driver=odbc database=grass6test db.copy from_driver=dbf from_database=./ from_table=mytable to_driver=odbc to_database=grass6test to_table=mytable Next link map to attribute table (now the ODBC table is used, not the dbf file): v.db.connect map=mytable.shp table=mytable key=ID database=grass6test driver=odbc v.db.connect -p Finally a test: Here we should see the table columns (if the ODBC connection works): db.tables -p db.columns table=mytable Now the table name 'mytable' should appear. Doesn't work? Check with 'isql ' if the ODBC-PostgreSQL connection is really established. Note that you can also connect mySQL, Oracle etc. through ODBC to GRASS. You can also check the vector map itself concerning a current link to a table: v.db.connect -p mytable.shp which should print the database connection through ODBC to the defined RDBMS. SEE ALSO
db.connect, v.db.connect, unixODBC web site, SQL support in GRASS GIS Last changed: $Date: 2011-02-07 18:59:50 +0100 (Mon, 07 Feb 2011) $ Help Index GRASS 6.4.2 grass-odbc(1grass)
All times are GMT -4. The time now is 11:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy