Sponsored Content
Top Forums Shell Programming and Scripting Passing the unix variable to sqlplus Post 302232501 by Anaramkris on Thursday 4th of September 2008 03:20:57 PM
Old 09-04-2008
Yeah.i got it.

I did like this. i have assigned two variables $1 and $2 to do this.

$1 -normal Table name
$2 - Externabl table to be created from normal table with _ext.

so, . ./script abc abc_ext creates the external table i want. The below one works perfect.

echo "CREATE TABLE SCHEMA.$EXT_TAB
ORGANIZATION EXTERNAL
(
TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY DATA_PUMP_DIR1
LOCATION('$EXT_TAB.dmp1','$EXT_TAB.dmp2','$EXT_TAB.dmp3','$EXT_TAB.dmp4')
)
PARALLEL 4
AS SELECT * FROM SCHEMA.$TABLE;" > file.sql
sqlplus / < file.sql

Thanks for your help.
anaramkris
 

10 More Discussions You Might Find Interesting

1. Programming

Passing C Variable To Unix

I want to pass a variable set in my c program to a shell script (which will also be invoked or initiated from the same C program using the C's system command). Is it possible ? :confused: (3 Replies)
Discussion started by: kapilv
3 Replies

2. UNIX for Advanced & Expert Users

How to pass unix variable to SQLPLUS

hi fellows, can any body tell me how to pass unix variables to oracle code is... #! /bin/ksh echo ENTER DATE VALUE's read START_DATE END_DATE sqlplus xyx/abc@oracle select * from table1 where coloumn1 between $START_DATE and $END_DATE; is this is correct way........... Thanks in... (1 Reply)
Discussion started by: chiru
1 Replies

3. UNIX for Advanced & Expert Users

passing unix variable to sqlplus without a file name

Hi, I want to input unix variable to sqlplus.The following is working fine sqlplus username/password @dummy.sql param1 param2 << EOF create user $1 identified by $2; EOF But I dont want any file name to be passed,I just want to pass the parameter. Is there any way to that?? Thanks... (3 Replies)
Discussion started by: sakthi.abdullah
3 Replies

4. UNIX for Dummies Questions & Answers

select count(*) in sqlplus into variable unix shell

Need to select count(*) from table to check for zero result in unix script (2 Replies)
Discussion started by: struggle
2 Replies

5. Shell Programming and Scripting

error in passing a variable to sqlplus from a shell script

hi, I am using a shell script from where i will be conecting to sqlplus.. i am having a problem in passing a variable to sqlplus query.. i will be assigning the variable in the unix environment..whenever i am trying to pass a variable having the contents greater than 2500 characters, i am... (3 Replies)
Discussion started by: kripssmart
3 Replies

6. UNIX for Dummies Questions & Answers

Passing a Unix parameter to SQLPlus login command

hi All, i m trying to pass a user choice paramter from unix to sqlplus connect command here i want the user to enter the username and password he wants to connect in sql plus through read in unix and then automatically connect to that instance. sqlplus -s $1/$2 where $ 1 and $2 will b... (2 Replies)
Discussion started by: Jcpratap
2 Replies

7. Shell Programming and Scripting

passing an unix variable to an XML

I need help I have a unix command : VERSION=$(ls -d /vsn/v12.??.??.?? | sort | tail -1) when i do echo $VERSION, i get the exact value, i want. Now i want to use this variable and pass it to an xml. How can i do that? (1 Reply)
Discussion started by: samk
1 Replies

8. Shell Programming and Scripting

How to print huge values in sqlplus variable in UNIX?

Hi, I ahve a unix code as below. sqlTxt=$* sqlReturn=`echo "set feedback off; set heading off; set term off; set verify off; set serveroutput on size unlimited set lin 1000; VARIABLE GV_return_val NUMBER; VARIABLE GV_script_error varchar2(4000); EXEC :GV_return_code := 0; EXEC... (6 Replies)
Discussion started by: bhaski2012
6 Replies

9. Shell Programming and Scripting

Passing sqlplus output to shell variable

Hi , I am using below code : for i in `ps -ef|grep pmon|awk {' print $8 '}|cut -f3 -d'_'|grep -v '^grep'` do ORACLE_SID=$i export ORACLE_SID; dest=`sqlplus "/ as sysdba" <<EOF set heading off feedback on verify off select DESTINATION from v\\$archive_dest where target in... (5 Replies)
Discussion started by: admin_db
5 Replies

10. UNIX for Beginners Questions & Answers

Sqlplus variable UNIX

hi guys i have a sqlplus : sqlplus -s username/password << EOF @mysql.sql EOF in mysql.sql there is a count of a table, i want to write in a variabile unix. how can i do? Thanks a lot Regards Francesco. (3 Replies)
Discussion started by: Francesco_IT
3 Replies
SQL::Translator::Parser::PostgreSQL(3pm)		User Contributed Perl Documentation		  SQL::Translator::Parser::PostgreSQL(3pm)

NAME
SQL::Translator::Parser::PostgreSQL - parser for PostgreSQL SYNOPSIS
use SQL::Translator; use SQL::Translator::Parser::PostgreSQL; my $translator = SQL::Translator->new; $translator->parser("SQL::Translator::Parser::PostgreSQL"); DESCRIPTION
The grammar was started from the MySQL parsers. Here is the description from PostgreSQL: Table: (http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=sql-createtable.html) CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( { column_name data_type [ DEFAULT default_expr ] [ column_constraint [, ... ] ] | table_constraint } [, ... ] ) [ INHERITS ( parent_table [, ... ] ) ] [ WITH OIDS | WITHOUT OIDS ] where column_constraint is: [ CONSTRAINT constraint_name ] { NOT NULL | NULL | UNIQUE | PRIMARY KEY | CHECK (expression) | REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] and table_constraint is: [ CONSTRAINT constraint_name ] { UNIQUE ( column_name [, ... ] ) | PRIMARY KEY ( column_name [, ... ] ) | CHECK ( expression ) | FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ] [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] Index: (http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=sql-createindex.html) CREATE [ UNIQUE ] INDEX index_name ON table [ USING acc_method ] ( column [ ops_name ] [, ...] ) [ WHERE predicate ] CREATE [ UNIQUE ] INDEX index_name ON table [ USING acc_method ] ( func_name( column [, ... ]) [ ops_name ] ) [ WHERE predicate ] Alter table: ALTER TABLE [ ONLY ] table [ * ] ADD [ COLUMN ] column type [ column_constraint [ ... ] ] ALTER TABLE [ ONLY ] table [ * ] ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT } ALTER TABLE [ ONLY ] table [ * ] ALTER [ COLUMN ] column SET STATISTICS integer ALTER TABLE [ ONLY ] table [ * ] RENAME [ COLUMN ] column TO newcolumn ALTER TABLE table RENAME TO new_table ALTER TABLE table ADD table_constraint_definition ALTER TABLE [ ONLY ] table DROP CONSTRAINT constraint { RESTRICT | CASCADE } ALTER TABLE table OWNER TO new_owner View table: CREATE [ OR REPLACE ] VIEW view [ ( column name list ) ] AS SELECT query AUTHORS
Ken Y. Clark <kclark@cpan.org>, Allen Day <allenday@ucla.edu>. SEE ALSO
perl(1), Parse::RecDescent. perl v5.14.2 2012-05-01 SQL::Translator::Parser::PostgreSQL(3pm)
All times are GMT -4. The time now is 11:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy