Thanks to all who responded, Appreciate it. The grok approach was not working so had to go with the following one.
Now just 1 more problem is that how I do I set the environment, say if I want to do set head off, in the following command can I do that? The following command I had to do :- echo "SELECT a.username,substr(sql_text,1,100) as \"SQL TEXT\",substr(sql_text,101,250) as \"Second Text\",substr(sql_text,601,250) as \"Third Text\",substr(sql_text,851,250) as \"Fourth Text \",substr(sql_text,1101,250) as \"Fifth Text \" FROM sys.dba_users a, v\$session, v\$sqlarea where parsing_user_id=user_id AND address=sql_address(+) and sid = #sid ; " | $ORACLE_HOME/bin/sqlplus #username/#passwd@$ORACLE_SID -- On Tue, 04 Dec 2001 16:06:01 Reardon, Bruce (CALBBAY) wrote: >After testing prompted by Jared's reply, you can use 1 of the 2 alternatives >from Windows. > >That is, under windows the following works: >echo select * from dual; | sqlplus scott/tiger@abcd > >I often use this type of syntax under NT to (say) log the time as below, but >had never thought to try it with sqlplus. >eg time example >C:\>echo.|time|find "current" /i >The current time is: 10:54:24.94 > >Hope this helps someone, >Bruce Reardon > >-----Original Message----- >Sent: Wednesday, 5 December 2001 3:25 > >As Scott said, in Unix you can use Input Redirection. If you are in >windows, you could always build the command as a .sql file and use the > >sqlplus -s scott/tiger @myfile.sql > >Command. > >-----Original Message----- >Sent: Tuesday, December 04, 2001 10:01 AM > >From the unix command line you can run: > >sqlplus -s scott/tiger << EOF >select * from emp; >EOF > > >Viraj Luthra wrote: >> >> Hello all, >> >> Why cannot I do :- >> >> sqlplus -s scott/tiger select * from emp; >> >> or sqlplus -s scott/tiger "select * from emp;" >> >> Both the cases I get :- >> >> Usage: SQLPLUS [<option>] [<user>[/<password>] [@<host>]] >> [@<startfile> [<parm1>] [<parm2>] ...] >> where <option> ::= { -s | -? } >> -s for silent mode and -? to obtain version number >> >> What is wrong above? I need to run the query from command line. How do I >modify this :- >> >> sqlplus -s scott/tiger select * from emp; >> >> Rgds, >-- >Please see the official ORACLE-L FAQ: http://www.orafaq.com >-- >Author: Reardon, Bruce (CALBBAY) > INET: [EMAIL PROTECTED] > >Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 >San Diego, California -- Public Internet access / Mailing Lists >-------------------------------------------------------------------- >To REMOVE yourself from this mailing list, send an E-Mail message >to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in >the message BODY, include a line containing: UNSUB ORACLE-L >(or the name of mailing list you want to be removed from). You may >also send the HELP command for other information (like subscribing). > -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Viraj Luthra INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).