Sponsored Content
Top Forums Shell Programming and Scripting Problems with fetching data from Oracle database Post 302775689 by Yoda on Tuesday 5th of March 2013 09:07:32 AM
Old 03-05-2013
I would suggest instead of using an array, spool the result to a file.
Code:
spool prod_list.txt
SELECT NAME FROM PRODUCT ;
spool off;

Then later use a while loop to read entries from the spooled file.
Code:
while read product
do
  echo "$product"
done < prod_list.txt

 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix script to export data from csv file to oracle database

Hello people, Need favour. The problem I have is that, I need to develop a unix shell script that performs recurring exports of data from a csv file to an oracle database. Basically, the csv file contains just the first name and last name will be dumped to an Unix server. The data from these... (3 Replies)
Discussion started by: vinayagan
3 Replies

2. Shell Programming and Scripting

Need Shell Script to upload data from Text file to Oracle database

Hi Does any one have any idea on uploading the data using Unix Shell script from text file to Oracle database. Requirement:- 1. Need to connect to Oracle database from Unix Shell script. 2. Need to pick Text file from some location on Unix Box. 3. Need to upload the data from text file to... (6 Replies)
Discussion started by: chandrashekharj
6 Replies

3. UNIX for Dummies Questions & Answers

Howto capture data from rs232port andpull data into oracle database-9i automatically

Hi, i willbe very much grateful to u if u help me out.. if i simply connect pbx machine to printer by serial port RS232 then we find this view: But i want to capture this data into database automatically when the pbx is running.The table in database will contain similar to this view inthe... (1 Reply)
Discussion started by: boss
1 Replies

4. Shell Programming and Scripting

Need shell script to extract data from oracle database

shell script (4 Replies)
Discussion started by: frns5
4 Replies

5. Shell Programming and Scripting

how to extract the data from database (oracle) and send the output as an .xls file?

Hi, How to extract the data from Oracle database and sent the output data to mails using mailx command with .xls attachement? Here i know how to connect the database using unix shell script and how to use the mailx command in UNIX script But i don't know how to use the .xls format file (i... (1 Reply)
Discussion started by: psiva_arul
1 Replies

6. Shell Programming and Scripting

why do we need UNIX shell script to load data into Oracle database

Hello everyone, I am new to shell scripting/ loading data into a database. I want to load data into Oracle database using SQL loader. Can some one please explain why do we need unix shell script to load the data into the database? Also can someone please explain what has to be in that script?... (5 Replies)
Discussion started by: new_prog
5 Replies

7. Shell Programming and Scripting

Mask the Oracle Database Data

Hi, We have to mask the data that is coming from production environment to Non-production environment. The database is running in oracle platform. If anybody has generic scripts to achive this task,it would be great if that can be shared with me? Thank you, Jayaprakash. (10 Replies)
Discussion started by: bandaru_0810
10 Replies
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)
All times are GMT -4. The time now is 10:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy