Sponsored Content
Top Forums Shell Programming and Scripting Oracle 11g script read from file in where clause (RHEL 5.7) Post 302882933 by gacanepa on Thursday 9th of January 2014 05:16:40 PM
Old 01-09-2014
Hammer & Screwdriver Oracle 11g script read from file in where clause (RHEL 5.7)

Hi everyone,
Simple question.
I have a comma-delimited file, aux.txt, with the following contents (all in one line):
Code:
'value1','value2','value3',...,'valueN'

I would like to know if there's a way I can use that file inside a sql script in a where clause, like so:
Code:
select myfield1 from mytable
where myfield2 IN ('value1','value2','value3',...,'valueN')

This works if I hard code the values 'value1','value2','value3',...,'valueN' into the script. But the contents of the file aux.txt will be changing over time, so I'm looking for a way to read its contents directly into the script.
I read here that doing this would do, but it didn't work:
Code:
select myfield1 from mytable
where myfield2 IN 
(
@aux.txt
)

I have also tried to include the absolute path to aux.txt, but to no use.
When I run this query, I get the following error: ORA-00936: Missing Expression.
Any ideas or hints will be more than appreciated.
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Switching user to oracle to connect Oracle 11g DB with 'sysdba'

I need to connect my Oracle 11g DB from shell script with 'sysdba' permissions. To do this I have to switch user from 'root' to 'oracle'. I've tried the following with no success. su - oracle -c "<< EOF1 sqlplus -s "/ as sysdba" << EOF2 whenever sqlerror exit sql.sqlcode;... (2 Replies)
Discussion started by: NetBear
2 Replies

2. UNIX for Beginners Questions & Answers

ksh scripts migrating(Oracle 11G) from Solaris Sparc 10 to RHEL 7

Hi All, Now we are migrating oracle 11G from Solaris Sparc 10 to RHEL 7. We have 1000+ ksh scripts.. Could you please let em know what would be the best way to use exiting scripts in RHEL with minimal changes,. my concern was "Is it all Solaris command work in RHEL". (3 Replies)
Discussion started by: mssprince
3 Replies
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. Please notice this option isn't related to the terminal length as in a "80 culums terminal". --font=desc Set the font description. Default is Monospace 12. --rtl Do right to left (RTL) layout. --paper ps Choose paper size. Known paper sizes are legal, letter and A4. Default is A4. Postscript points Each postscript point equals to 1/72 of an inch. 36 points are 1/2 of an inch. --bottom-margin=bm Set bottom margin. Default is 36 postscript points. --top-margin=tm Set top margin. Default is 36 postscript points. --left-margin=lm Set left margin. Default is 36 postscript points. --right-margin=rm Set right margin. Default is 36 postscript points. --gutter-width=gw Set gutter width. Default is 40 postscript points. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 05:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy