Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

linux + oracle + sqlplus + awk, script doesn't work

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
marchello
Posts: 60
Joined: 2013-10-08 08:47

linux + oracle + sqlplus + awk, script doesn't work

#1 Post by marchello »

Hi all,

We get log_id value empty after migration.

Code: Select all

log_id=$(sqlplus -s /nolog <<-EOF|awk 'NR==2 {print $1}'
  set head off
  set feed off
  set pagesize 0
  conn $DBCONN_AUDIT
  select pls_audit.get_id_log from dual;
#EOF)
Maybe (I'm not sure) the problem is in awk.
Last time http://forums.debian.net/viewtopic.php?f=8&t=119236 we had problem with

Code: Select all

awk -F\t
changed it to

Code: Select all

awk '-F\t'
(works great).

Please someone comment is it problem in awk syntaxis and how to solve.
Thanks ahead.

marchello
Posts: 60
Joined: 2013-10-08 08:47

Re: linux + oracle + sqlplus + awk, script doesn't work

#2 Post by marchello »

This way it works fine:

Code: Select all

echo -e "conn user1/pass1@plspro\nselect pls_audit.get_id_log from dual;" | sqlplus -s /nolog

GET_ID_LOG
----------
  33363309
So I guess it is not Oracle question, it is more linux question about syntaxis...

Maybe someone can kindly help please?

Post Reply