Maximum length of SQL*Plus Command?

I'm typing a long query into SQL*Plus (Linux, version 9.2.0.1... yes, I know it's ancient).
If I run this query, all works fine:
select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when upper(value) in ('DBO','TRUE')  then (select agg_concat(grantee) from dba_tab_privs where table_name='AUD$')
else (select 'AUDIT_TRAIL is set to: '||value from dual) end as grantee from v$parameter where upper(name)='AUDIT_TRAIL' order by grantee);
'UPDATEMYAUDITING_TABLESETTEST_DETAILS='''||GRANTEE||'''WHEREMYAUDIT_REFNO=''A.F
update myauditing_table set test_details='AUDIT_TRAIL is set to: DB' where myaud
it_refno='A.FE';(In other words, is SQL that generates other SQL: if AUDIT_TRAIL is set to something interesting, tell me who has access to the AUD$ table. And it's working fine... the agg_concat function mentioned is simply Tom Kyte's stragg function under another name, as lifted word-for-word from http://www.sqlsnippets.com/en/topic-11591.html)
Now this is what happens if I take out the linebreak after the mention of AUD$, so that the command is submitted as one single line of code:
SQL> select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when upper(value) in ('DBO','TRUE')  then (select agg_concat(grantee) from dba_tab_privs where table_name='AUD$') else (select 'AUDIT_TRAIL is set to: '||value from dual) end as grantee from v$parameter where upper(name)='AUDIT_TRAIL' order by grantee);
SP2-0734: unknown command beginning "s set to: ..." - rest of line ignored.The error message indicates that the text has been 'split' at the 'AUDIT_TRAIL is set to...' bit, so that "s set to" is being treated as a new command, which is of course syntactically invalid. There is definitely no other change in text between the two versions, apart from the removal of a carriage return before the "else" statement.
Possibly a coincidence, but the first "s" in "s set to" appears at position 258 in the entire text... close to a possible 255 or 256 character limit, perhaps?
The same problem happens whether I run the command as a script (@mysql.sql) or typed in directly into a client SQL*Plus session. Is there some inherent limit to the length of commands that SQL*Plus can process in this version? My code runs fine on 10g and 11g databases/clients, whether it's on one line or two. Anyone know of a bug in 9i regarding this? And if there's a workaround (other than the obvious one of upgrading, of course!)

As mentioned, it's choking at the 258th character, not the 240th. Also, it's a SELECT statement, not a COPY command (one relates to the database, the other is an internal SQL*Plus feature). And someone else also kindly pointed out that SQL*Plus has a command limit length (i.e., database-related commands) of 2500 characters. So I don't think that's the issue.
I can be a bit more specific about this one now, though. I've a sequence of Solaris boxes running 9.2.0.1 up, and the results are that 9.2.0.1 is affected; and it's a problem for 9.2.0.7:
SQL> select * from v$version;
BANNER
Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
PL/SQL Release 9.2.0.1.0 - Production
CORE    9.2.0.1.0       Production
TNS for Solaris: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
SQL> select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when upper(value) in ('DBO','TRUE')  then (select agg_concat(grantee) from dba_tab_privs where table_name='AUD$') else (select 'AUDIT_TRAIL is set to: '||value from dual) end as grantee from v$parameter where upper(name)='AUDIT_TRAIL' order by grantee);
SP2-0734: unknown command beginning "s set to: ..." - rest of line ignored.And...
SQL> select * from v$version;
BANNER
Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
PL/SQL Release 9.2.0.7.0 - Production
CORE    9.2.0.7.0       Production
TNS for Solaris: Version 9.2.0.7.0 - Production
NLSRTL Version 9.2.0.7.0 - Production
SQL> select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when upper(value) in ('DBO','TRUE')  then (select agg_concat(grantee) from dba_tab_privs where table_name='AUD$') else (select 'AUDIT_TRAIL is set to: '||value from dual) end as grantee from v$parameter where upper(name)='AUDIT_TRAIL' order by grantee);
SP2-0734: unknown command beginning "s set to: ..." - rest of line ignored.But in 10.2.0.1, the problem disappears.
I am not sure, but it is perhaps related to metalink note 285913.1, since we did get some ORA-00600: internal error code, arguments: [qernsRowP], [1] errors in the alert log with a slightly different version of the above query. Changing the query obviously alters the test, though, so it may be completely unrelated.
Either way, I think it's definitely a version-specific SQL*Plus bug (though it would be nice if any other 9i owners out there could try it and report back!)
Anyway, the workaround is simply to submit the command on two separate lines, wherever possible. And of course... to upgrade.

Similar Messages

  • SQL Plus command to print a report in Landscape format

    Hi,
    what is the SQL Plus command to print a report in Landscape format?

    841731 wrote:
    Hi,
    what is the SQL Plus command to print a report in Landscape format?SQLPlus doesn't print, and it doesn't know about 'landscape' vs. 'portrait' any more than it knows about fonts. the only 'formatting' it knows is line size, page size. And all it does with line size is know where to insert a CR/LF pair (windows) or a CR (*nix). The only thing it knows to do with page size is repeat column headers.
    The rest is up to whatever application you use to open the pure asciii text spool file.

  • How to find GUI SQL*Plus command tool in Oracle 8i (version 8.1.7)

    I had installed Oracel 8i Enterprise Edition (version 8.1.7) on my server machine (Windows NT 4.0), I'd like to use Oracle Navigator (GUI SQL*PLUS command tool), but I can not find it from the menu. I know Oracle Navigator is available in Oracle 7. Can anyone tell me where and how to use GUI SQL*PLUS command tool in Oracle 8i Enterprise Edition (version 8.1.7) ?
    thanks a lot.
    David Zhu

    Hi
    Oracle Navigator is part of Personal Oracle7 and Oracle Lite. I don't know is it available in 8i Personal Edition but I am sure that it is not part of Standard and Enterprise Edition.
    Regards
    null

  • How to issue a SQL*Plus command from PL/SQL program?

    Thanks.

    You can't issue a SQL*PLus command from a PL/SQL program. If you can tell us more about what you are trying to do, perhaps we can offer a substitute.

  • Need to execute SQL PLUS commands from C# code

    Hello all,
    This is my first question here and hopefully I will get my solution :)
    Right now we are doing 3 tasks manually
    1) Clearing everything from a DB.
    We use sql plus and execute this :
    RAMNIVAS_CI/RAMNIVAS_CI@orclwex3
    set pages 0
    set lines 80
    spool c:\delete_objects_CI
    select 'drop '||object_type||' '||object_name||';'
    from user_objects;
    spool off
    start c:\delete_objects_CI.lst
    purge recyclebin;
    set pages 100
    select count(*) from user_objects;
    RAMNIVAS_CI/RAMNIVAS_CI@orclwex3 are the username and pwd which gets input when we paste entire thing in sql plus
    2) Then we restore that DB again using sql plus to do it using the command:
    imp file=CL.DMP log=CL.log buffer=1000000 fromuser=RAMNIVAS_CL touser=RAMNIVAS_CL statistics=none grants=n commit=y
    3)Execute sql scripts on it using sql developer. (This is not hard I guess coz I know we can use oracle client)
    4) Take backup using this command:
    exp RAMNIVAS_CI/RAMNIVAS_CI@ORCLWEX3 file=CI.dmp log=CI.log direct=y compress=y buffer=1000000 grants=n statistics=none
    Is there anything I cna do to execute SQL PLUS commands using c#?

    Hi,
    You can execute OS commands via the SHELL function provided in .NET. See the MSDN for more info.
    Some of the things you can do directly from .NET via ODP and PLSQL, some not.
    1) Dropping the user objects can be done via a plsql procedure where you open a cursor for "select 'drop '||object_type||' '||object_name||';' ..." and then use EXECUTE IMMEDIATE to execute the resulting commands. You can invoke the procedure via ODP.
    2) IMP is an exe, not a sqlplus command, so you're not actually using sqlplus there. You can still use the SHELL command though to invoke that.
    3) Executing SQL Scripts via ODP.NET is not something you can do very easily. If you search the threads here you should be able to find some solutions others have come up with to parse the file and execute the statements one by one, but there's nothing built in to ODP to execute a script file.
    You may want to just shell out to sqlplus user/pwd@db @scriptfile.sql but you may have issues trying to track down errors if any occurred, as I'm not sure where they go in that case.
    4) just as with IMP, EXP is an exe, so you could shell out to that.
    Corrections/comments welcome.
    Greg

  • .......Embedding  SQL PLUS commands inside PL/SQL.....

    hai every body,
    I have a doubt regarding sql plus commands and PL/SQL..I am using Oracle 10g..I have created 1 procedure for deletion/updation of transactions..and the number of effected rows I just displayed with using " *dbms_output.put_line* (SQL%ROWCOUNT)"..hence before executing the procedure the sqlPlus command "*SET SERVEROUTPUT ON*" should turn on..at most times it is forget to turn on and output becomes vague..
    hence my question is "*Is there any package or any thing to execute sql plus commands(here it is SET SERVER OUTPUT ON) through PL/SQL statements???*"
    with thanks,
    jp@valapad

    jp@valapad wrote:
    I have a doubt regarding sql plus commands and PL/SQL..
    Easy PL/SQL supports PL/SQL commands and embedded SQL, which are found in the PL/SQL and SQL reference manuals.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/toc.htm
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/toc.htm
    It does not support the commands of other applications or languages such as SQL*Plus, Unix or COBOL for example.
    I am using Oracle 10g..I have created 1 procedure for deletion/updation of transactions..and the number of effected rows I just displayed with using " *dbms_output.put_line* (SQL%ROWCOUNT)"..hence before executing the procedure the sqlPlus command "*SET SERVEROUTPUT ON*" should turn on..at most times it is forget to turn on and output becomes vague..You can set serveroutput on in your log in script for SQL*Plus if you keep forgetting.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/ch_two.htm#sthref94
    hence my question is "*Is there any package or any thing to execute sql plus commands(here it is SET SERVER OUTPUT ON) through PL/SQL statements???*"No.

  • Executing Sql* plus commands

    Hi
    Can we execute SQL *plus commands using JDBC OCI Driver. If so What is the procedure to execute and Which parameters to be set
    With Regards
    Vara Prasad

    AFAIK: no, you can't. SQL*plus is kind of a shell (the worst one I've seen so far), so via JDBC (both OCI and thin), you lack the interpreter.

  • Running a SQL*Plus command from Java

    I have a requirement to run SQL* Plus commands from Java. The results as they would appear in SQL*Plus window or spool file should be captured and stored in a table.
    For example,
    SQL> select * from dual;
    D
    X
    1 row selected;
    SQL>
    All the lines above should be stored for later use.
    Could any one give pointers?
    Thanks,
    Ravi

    <p>
    Hi,
    </p>
    <p>
    <strong><font face="Courier New">
    public class RuntimeExecApp {
     public static void main(String args[]) throws IOException
      Runtime r = Runtime.getRuntime();
      r.exec(&quot;C:\\Oracle\\sqlplus.exe&quot;);
    }</font></strong>
    </p>
    <p>
    Kuba 
    </p>
    Message was edited by:
    KUBA

  • SQL * Plus commands using JDBC

    Hi,
    Is it possible to run SQL * Plus commands using JDBC?
    Like Describe mytable , @mysql.sql etc....
    Pl. let me know any hints or way to handle it..
    Regards,
    Kavi

    like masuda1967 said, and you have MetaData objects for ResultSets as well.
    @something.sql you can call using CallableStatement objects, look it up in jdbc docs....

  • How to control layout in SQL*plus command

    Hi, All,
    I use SQL*plus to generate a simple report
    BREAK ON <column1> duplicates skip page ON REPORT
    COMPUTE COUNT LABEL 'Total number of trader shown on this report for this :' OF <column2> On <column1>
    it shows '********' and '-------------------' above the lable and compute result.
    Can I take '******' and '----------------' off
    and the label can not longer than the length of <column1>, otherwise it will be truncated.
    what if it is longer than the length of <column1>
    and I don't want to change the layout of <column1> ?
    Thanks

    Peter,
    FYI, this forum is dedicated for Oracle Reports issues. There's another forum dedicated to SQL*Plus - I believe it's now called iSQL*Plus, btw. You should try your question in the other forum.
    regards,
    Stewart

  • Is Sql plus command avaliable in sql developer

    SQL developer is able to do most of thing can be done with sql plus with GUI , cool.
    However, seems sql command, such as show parameter, start database have to be done in sql plus.
    is this true?
    most of time in my development, I just open sql developer now. but seems in this statuation, i have to use sql plus.

    jz2 wrote:
    SQL developer is able to do most of thing can be done with sql plus with GUI , cool.
    However, seems sql command, such as show parameter, start database have to be done in sql plus.
    is this true?
    most of time in my development, I just open sql developer now. but seems in this statuation, i have to use sql plus.As far as I know you still have to start the database from SQL*PLUS. If your schema has privileges you can get parameter values in SQL*Developer by querying V$PARAMETER (SET_CATALOG_ROLE privilege).
    The two tools are not the same. Much of what you can do with SQL*PLUS you can do with SQL*Developer but I feel that SQL*PLUS still has better scripting abilities along with its bind variable storate. On the other hand the GUI interface of SQL*Developer Is fairly easy to use. The danger is editing procedures/functions/packages in the database forgetting to back them up from SQL*Developer first; SQL*PLUS forces me to use scripts.
    Depending on what I am doing I use either SQL*PLUS or SQL*Developer (which I like better for queries with long select lists).
    I'm having trouble getting DBMS_OUTPUT.PUT_LINE to work the way I expect in SQL*Developer; sometimes the output just does not appear without repeated executions of the generating program.

  • SQL works from SQL*Plus command line but not as a DBMS_JOB submitted job

    Oracle 10g 10.2
    Got a procedure which does not run correctly as an Oracle job but runs fine as a SQL script.
    There are no Oracle errors (or any errors) of any kind when the job does not run fine – it just does not update any rows. But when run as a SQL script – the same way it is run as a job – then the rows are updated.
    Any ideas?

    Good stuff....
    See my replies to some of the questions in italics
    a) Different NLS settings => The job uses the NLS settings of the session that created it. If you create it with some tool like TOAD, you might have a different environment than with sql*plus. Runs good in TOAD and SQL*Plus using the command-line feature - just 'acts funky' when submitted.
    b) Interval issue. Are you sure the job was running? Isn't still running? The job runs successfully - even logs a successful message in our logging table.
    c) User/priviledge issue. Sometimes a job needs direct grants whereus a procedure can be called with priviledges granted through roles. Don't know - need to check this out.
    d) Transaction handling / Error Handling. The job runs into some error, but the error is supressed, because of bad exception handling. What is the value in the BROKEN column, when you do: select * from user_jobs; I would think that, since the errors are logged into a side table, an error would be found there. However, no errors are found. The BROKEN column is 'N'.

  • SQL Plus command line: Arrow keys not giving previous commands back

    As in tittle, I'm using sqlplus on Windows XP and OEL 5.5 and I can use up,down arrows in Windows to select previous command but I can't do it in Linux.
    My DB is 11gR2 on OEL 5.5 .

    Hi,
    Sorry, I don't know anything about Linux. The up-arrow feature on Windows seems to be provided by the operating system, not by Oracle. I would guess it's that way on Linux, too.
    In Windows, there's one more thing that affect this: Properties -> Options -> Command History. Perhaps Linux has something similar.
    In Windows (not just SQL*Plus or Oracle programs) if you right-click on the title bar at the top of a window, uyou get a small drop-down.
    If you select the last item, "Properties", you get a small window with 4 tabs, the 1st of which is "Options".
    On that "Options" tab, there are some settings for "Command History", oncluding Buffer Size. That seems to be the number of old ommands it will keep. You can set it to 0, but that seems to still keep 1 old command available via up-arrow.
    Sorry I don't know any more.

  • Promblem with SQL*PLUS command

    I use command 'set headsep !' to split a title onto more lines,
    but it doesn't work.
    And I want to use 'compute sum'to get the sum of salary of
    employees who are managed by a given manager(to be entered at
    run time).How to do that?
    Thank you.

    I use command 'set headsep !' to split a title onto more lines,
    but it doesn't work.
    You didn't send your code, so I can't give you the problem with
    your code. Here's an example that works:
    set headsep !
    show headsep
    column department_id heading 'Department!Identifier'
    select department_id from emp_details_view;

  • Sql*plus commands

    Hi,
    Can someone explain me what does this mean by
    "connect / as sysdba | sysoper /nolog"
    what does each of these above commands do?
    and does this above statement means that we are logging into sqlplus using OS authentication?
    so does it mean than anybody can login?
    what abt the security issues when use this above command?
    Can someone guide me please.
    Thanks in advance,
    Philip.

    Hi,
    connect "/ as sysdba" means connect to the sys account using my OS id if I have permission to be sysdba -- am in the v$pwfile_users table (external password file).
    i did not understand this. what do u mean by
    1. my OS id
    2. if i have permission
    i checked v$pwdfile_users and i found only sys account true for both sysdba and sysoper. so does it mean only sys can be a sysdba and sysoper.
    so in this case what abt OS authentication. is it that there is no OS authentication and i cannot login as "connect / as sysdba"
    Philip.

Maybe you are looking for

  • Is this legit softwareBuild: "11B554a"

    softwareBuild: "11B554a"

  • Questions about exporting to full quality?

    Hey there - I just wanted to make sure that if I want to give my friend back a DV file from the converted tape that I choose Export, then Full Quality? I know that creates one file vs individual clips but her tape was one long one, I did chapter mark

  • Using ADM for create custom drawed items

    Hi, I've started a new color selector plugin for CS3. The Win version works well. But the Mac version doesn't call the draw procs (set by Item Suite's SetDrawProc). I've create all items on the dialog box by ADM Dialog Suite (CreateItem). All the tra

  • Accessing Web Application

    Hi, I have created a sample ear with the ejb archive & the web archive & deployed to the J2ee engine. I have a jsp in the web module. What is the url i need to give to access this from the browser? Thanks in advance

  • #NA in preview mode, but looks fine in workspace?

    I recently upgraded to the newest fix pack and I'm not able to see data show up on the preview anymore.  I may have changed something in between and the upgrade issue may be a coincidence... The formula's I'm using are: =VLOOKUP((CONCATENATE($A$5,$B$