I am trying to add the query
in the current script....
Read the result set and look for the TABLE_NAME field. If the field is pointing to one table eg. METADATA_A, I need to truncate the opposite table METADATA_B.
Then, load the opposite table using SQLLOADER.
Then, switch Synonym by CREATE OR REPLACE PUBLIC SYNONYM to the opposite table.
I tried to add these commands in the script..Somehow, it is not working...
Hi all,
In a shell script I need to pass two parameters to a pl/sql script and get the ouput of the pl/sql script and use it in shell script.
For example
Shell script : test.sh
PL/SQL script : get_id.sql parameter1 parameter2
Actually get_id.sql has a select statement something... (1 Reply)
Hello everybody
I need help calling sql file from shell script.
Can anyone help me creating a small shell script which calls an sql file .
The .sql file should contain some select statements like
select emp_no from emp_table;
select emp_id from emp_table;
And the results should be... (6 Replies)
Hi-
I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment...
I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Dear All,
I want to call an sql script within a unix shell script. I want to pass a parameter into the shell script which should be used as a parameter in teh sql script.
e.g
$ ./shell1.sh 5000129
here 5000129 is a prameter
inside shell script i am calling one sql script
e.g. ... (2 Replies)
Hi
I have a shell script that call a sql file. The sql file will create a spool file.
My requirement is, when ever i get an OS error like file not found. I have to log it in a log file.
Could some who worked in a like scenario help me by giving the code sample.
Many Thanks.. (1 Reply)
Hello gurus,
I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script.
i m looking for something like this
call 3.1;
If 3.1 = "complete" then
call 3.2;
if 3.2 = ''COMPlete" then
call 3.3;
else
exit
The... (1 Reply)
Hi,
I want to call a sql file in my shell script. see the below code:-
if ]
then
(
isql -U${S_USER} -S${S_SERV} -w100 -b -h0 <<ENDSQL | sed -e "s/Password://"
${S_PWD}
set nocount on
go
use ${S_DB}
go
// need to call a file name... (16 Replies)
Hi,
I am calling a sql file script.sql from shell script and passing few parameters also as shown below:
sqlplus -S id/password @script.sql $param1 $param2
Now,In sql file I have to create a extract text file after querying oracle tables based on the parameters passed(param1,param2) as... (7 Replies)
I have a master shell script which calls some 40 shell scripts. All the shell scripts calls a sql file which executes some sql statements.
I run these scripts in parallel such that it saves me time. When i executed them i saw some strange behavior.
Firstly, I found that some scripts among the 40... (1 Reply)
Hi,
i have one simple PL/SQL Block and i have saved it as .sql file, which i am trying to call from UNIX script.
PL/SQL block structure
CONNECT DB_NAME/PWD@Database
whenever SQLERROR EXIT 1;
Declare
..Variables...
BEGIN
--Code--
exception
END;
exit;
I have save this block as... (3 Replies)
Discussion started by: abhii
3 Replies
LEARN ABOUT REDHAT
create_table_as
CREATE TABLE AS(7) SQL Commands CREATE TABLE AS(7)NAME
CREATE TABLE AS - create a new table from the results of a query
SYNOPSIS
CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name [ (column_name [, ...] ) ]
AS query
DESCRIPTION
CREATE TABLE AS creates a table and fills it with data computed by a SELECT command. The table columns have the names and data types asso-
ciated with the output columns of the SELECT (except that you can override the column names by giving an explicit list of new column
names).
CREATE TABLE AS bears some resemblance to creating a view, but it is really quite different: it creates a new table and evaluates the query
just once to fill the new table initially. The new table will not track subsequent changes to the source tables of the query. In contrast,
a view re-evaluates its defining SELECT statement whenever it is queried.
PARAMETERS
[LOCAL] TEMPORARY or [LOCAL] TEMP
If specified, the table is created as a temporary table. Refer to CREATE TABLE [create_table(7)] for details.
table_name
The name (optionally schema-qualified) of the table to be created.
column_name
The name of a column in the new table. Multiple column names can be specified using a comma-delimited list of column names. If col-
umn names are not provided, they are taken from the output column names of the query.
query A query statement (that is, a SELECT command). Refer to SELECT [select(7)] for a description of the allowed syntax.
DIAGNOSTICS
Refer to CREATE TABLE [create_table(7)] and SELECT [select(7)] for a summary of possible output messages.
NOTES
This command is functionally equivalent to SELECT INTO [select_into(7)], but it is preferred since it is less likely to be confused with
other uses of the SELECT ... INTO syntax.
COMPATIBILITY
This command is modeled after an Oracle feature. There is no command with equivalent functionality in SQL92 or SQL99. However, a combina-
tion of CREATE TABLE and INSERT ... SELECT can accomplish the same thing with little more effort.
HISTORY
The CREATE TABLE AS command has been available since PostgreSQL 6.3.
SEE ALSO
CREATE TABLE [create_table(7)], CREATE VIEW [create_view(l)], SELECT [select(l)], SELECT INTO [select_into(l)]
SQL - Language Statements 2002-11-22 CREATE TABLE AS(7)