Sponsored Content
Top Forums Shell Programming and Scripting Use sqlplus statement inside case sentence Post 302774107 by jim mcnamara on Friday 1st of March 2013 07:39:58 AM
Old 03-01-2013
The ending SQL is not seen. It needs to be in the leftmost column. Or structured differently Your here doc need to be one of these:

Code:
           sqlplus -s user/pass <<-SQL
 
                query A;
            SQL

## OR this way
           sqlplus -s user/pass << SQL
 
                query A;
SQL

Note the red dash.
These 3 Users Gave Thanks to jim mcnamara For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script to ask for a sentence and then count number of spaces in the sentence

Hi People, I need some Help to write a unix script that asks for a sentence to be typed out then with the sentence. Counts the number of spaces within the sentence and then echo's out "The Number Of Spaces In The Sentence is 4" as a example Thanks Danielle (12 Replies)
Discussion started by: charlie101208
12 Replies

2. Shell Programming and Scripting

multiple lines inside a case statement

echo "please enter ur choice.. 1. Make a file. 2. Display contents 3. Copy the file 4. Rename the file 5. Delete the file 6. Exit" read choice case $choice in 1 ) echo enter the file name read fname if then echo... (2 Replies)
Discussion started by: gotam
2 Replies

3. Shell Programming and Scripting

Regular expression inside case statement notworking

I have the following script: For catching errors like: But the regular expression ERROR*memory inside case doesn't seem to be working. The output of bash -x scriptname is: Please help (5 Replies)
Discussion started by: proactiveaditya
5 Replies

4. Shell Programming and Scripting

how to use sqlplus command inside for loop

I tried this: for region in 'raj' 'kt' 'kol' 'krl' 'chn' 'dl' 'hr' 'bih' 'ap' do sqlplus -s huw$region/`echo $region`huw#321@huw$region<<! set serveroutput on begin select count(*) from tcd_preferred_cust_201109 end; / exit; done but the error shows like: Syntax error at line 4 :... (1 Reply)
Discussion started by: deepakprasad29@
1 Replies

5. Programming

SQLPlus Case statement on a substring

Hi, I have an SQL query that returns a substring of a field and I want to work a case statement on it, but either I get a syntax error or in it's current manifestation the case is ignored all together. select distinct dbms_lob.substr(msg_body,1,4) as networkId, A_STATUS, count(*) from... (1 Reply)
Discussion started by: chris01010
1 Replies

6. Shell Programming and Scripting

Connecting sqlplus from UNIX with multiple select statement

hi, i have a requirement where i need to connect sqlplus from unix and i am able to do so by following command: cust_count=`sqlplus -s $ORACLE_USER/$ORACLE_PASS@$ORACLE_SID << EOF set pagesize 0 set feedback off set verify off ... (1 Reply)
Discussion started by: lovelysethii
1 Replies

7. Shell Programming and Scripting

Error with nested if within an sqlplus task inside

Hi ALL, I am receving a "strange" error using a nested if within an sql operation inside: ./dom.ksh: syntax error at line 80 : `then' unmatched This is all my script code: in bold the step receiving the error. Any help would really aprrecieted ......! **** I have tried all the... (2 Replies)
Discussion started by: AndreaCecco
2 Replies

8. Shell Programming and Scripting

Sqlplus inside shell script writing to tmp file

Hi, facing an issue while calling sqlplus inside shell script. It for some reason goes to tmp file to write something and i get error as permission denied as i dont have access there. ANy idea why sqlplus writes in /tmp and how to change or stop this ? (2 Replies)
Discussion started by: rushikeshs
2 Replies

9. Shell Programming and Scripting

SQLPLUS command with more than 1 select statement

Hi all, I'm using below code processId=`sqlplus -s ${sysuser}/${syspwd} <<CHK_PROCESS whenever sqlerror exit sql.sqlcode; set head off feedback off echo off pages 0 SELECT PROCESS_ID FROM LSHADMIN.DATA_DOMAIN WHERE DOMAIN_NAME = '${tabname}' ... (8 Replies)
Discussion started by: Pratiksha Mehra
8 Replies
DB2_COLUMNS(3)								 1							    DB2_COLUMNS(3)

db2_columns - Returns a result set listing the columns and associated metadata for a table

SYNOPSIS
resource db2_columns (resource $connection, [string $qualifier], [string $schema], [string $table-name], [string $column-name]) DESCRIPTION
Returns a result set listing the columns and associated metadata for a table. PARAMETERS
o $connection - A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. o $qualifier - A qualifier for DB2 databases running on OS/390 or z/OS servers. For other databases, pass NULL or an empty string. o $schema - The schema which contains the tables. To match all schemas, pass '%'. o $table-name - The name of the table or view. To match all tables in the database, pass NULL or an empty string. o $column-name - The name of the column. To match all columns in the table, pass NULL or an empty string. RETURN VALUES
Returns a statement resource with a result set containing rows describing the columns matching the specified parameters. The rows are com- posed of the following columns: +------------------+---------------------------------------------------+ | Column name | | | | | | | Description | | | | +------------------+---------------------------------------------------+ | TABLE_CAT | | | | | | | Name of the catalog. The value is NULL if this | | | table does not have catalogs. | | | | | TABLE_SCHEM | | | | | | | Name of the schema. | | | | | TABLE_NAME | | | | | | | Name of the table or view. | | | | | COLUMN_NAME | | | | | | | Name of the column. | | | | | DATA_TYPE | | | | | | | The SQL data type for the column represented as | | | an integer value. | | | | | TYPE_NAME | | | | | | | A string representing the data type for the col- | | | umn. | | | | | COLUMN_SIZE | | | | | | | An integer value representing the size of the | | | column. | | | | | BUFFER_LENGTH | | | | | | | Maximum number of bytes necessary to store data | | | from this column. | | | | | DECIMAL_DIGITS | | | | | | | The scale of the column, or NULL where scale is | | | not applicable. | | | | | NUM_PREC_RADIX | | | | | | | An integer value of either 10 (representing an | | | exact numeric data type), 2 (representing an | | | approximate numeric data type), or NULL (repre- | | | senting a data type for which radix is not appli- | | | cable). | | | | | NULLABLE | | | | | | | An integer value representing whether the column | | | is nullable or not. | | | | | REMARKS | | | | | | | Description of the column. | | | | | COLUMN_DEF | | | | | | | Default value for the column. | | | | | SQL_DATA_TYPE | | | | | | | An integer value representing the size of the | | | column. | | | | |SQL_DATETIME_SUB | | | | | | | Returns an integer value representing a datetime | | | subtype code, or NULL for SQL data types to which | | | this does not apply. | | | | |CHAR_OCTET_LENGTH | | | | | | | Maximum length in octets for a character data | | | type column, which matches COLUMN_SIZE for sin- | | | gle-byte character set data, or NULL for non- | | | character data types. | | | | |ORDINAL_POSITION | | | | | | | The 1-indexed position of the column in the ta- | | | ble. | | | | | IS_NULLABLE | | | | | | | A string value where 'YES' means that the column | | | is nullable and 'NO' means that the column is not | | | nullable. | | | | +------------------+---------------------------------------------------+ SEE ALSO
db2_column_privileges(3), db2_foreign_keys(3), db2_primary_keys(3), db2_procedure_columns(3), db2_procedures(3), db2_special_columns(3), db2_statistics(3), db2_table_privileges(3), db2_tables(3). PHP Documentation Group DB2_COLUMNS(3)
All times are GMT -4. The time now is 07:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy