######### in sqlplus

Hello:
I'm using oracle 10g developer release for windows 2003 server AMD64.
When a command in sqlplus as below:
SQL> select value from v$mystat;
VALUE
what does ######## means.
Thanks

Yep.. I tried as Yogesh as suggested and here is my sqlplus snapshot:
SQL> set numwidth 40
SQL> select value from v$mystat where statistic# = 133;
VALUE
SQL> set numwidth 50
SQL> select value from v$mystat where statistic# = 133;
VALUE
##########

Similar Messages

  • Error in starting sqlplus

    Initializing first test to use userid: scott, password: tiger
    Attempting to connect using userid: scott
    The test did not succeed.
    ORA-12541: TNS:no listener
    There may be an error in the fields entered,
    or the server may not be ready for a connection.

    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
    and try again as user oracle:dba
    Regards: Michael
    craig (guest) wrote:
    : Hi all,
    : I've installed Oracle on RH5.2. It all seemed to go well. No
    : i've just run the root.sh script as root. Before going much
    : further, I wanted to start up the database (via svrmgrl). I
    : tried starting both svrmgrl and sqlplus and received an error
    : (error in loading shared libraries
    : libclntsh.so.1.0: cannot open shared object file: No such file
    : or directory)
    : I ran env from root. I don't see the environment variables I
    : defined for the install (e.g., ORACLE_HOME, ORACLE_SID, etc).
    : What is wrong?
    : Any help is appreciated.
    : craig
    null

  • Can not open sqlplus on Oracle10g/OEL5.0

    I have installed an Oracle10g database on the OEL5.0 system (not encounter any errors) today. But after finishing the installation, I can not login the sqlplus.
    [root@localhost ~]# sqlplus
    bash: sqlplus: command not found.
    When I loged in to the Database Console--->Administration-->Users, it dispayed no accounts table and no any users listed there.
    What is the problem?
    Thank you

    [root@localhost ~]# sqlplus
    bash: sqlplus: command not found.I can see two problems here:
    1. You are using root account as default (bad practice)
    2. Shell environment. Your current setting is missing $ORACLE_HOME/bin in PATH variable. You probably set the environment for "oracle" user but I don't think you did the same for "root".
    More information here: http://download.oracle.com/docs/cd/B19306_01/install.102/b15660/pre_install.htm#sthref709

  • SQLPLUS prompt in one row

    Hellou
    I need help in SQLPLUS. I need to prompt into the file one row of information like this:
    0000004202;;00151564;[email protected];160120071333
    this -> 0000004202;;00151564;[email protected]; is just static text
    this -> 160120071333 is date in format (ddmmyyyyHHMM)
    And I need it in one row
    prompt 0000004202;;00151564;[email protected]; select to_char(sysdate,'ddmmyyyyHH24MM') from dual
    does not work
    Can you help me?
    I used something Like this:
    spool file
    declare cas_aktual VARCHAR(12);
    begin
    select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
    dbms_output.enable;
    dbms_output.put_line('blabla'||cas_aktual||'konec');
    end;
    spool OFF
    But it isn't work too

    >
    I used something Like this:
    spool file
    declare cas_aktual VARCHAR(12);
    begin
    select to_char(sysdate,'ddmmyyyyHH24MM') into
    cas_aktual from dual;
    dbms_output.enable;
    dbms_output.put_line('blabla'||cas_aktual||'konec');
    end;
    spool OFF
    But it isn't work tooYou need a forward-slash character ("/") right after the PL/SQL block to allow sqlplus to run the contents of the buffer.
    test@ora>
    test@ora> spool c:\test.log
    test@ora>
    test@ora> declare cas_aktual VARCHAR(12);
      2  begin
      3  select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
      4  dbms_output.enable;
      5  dbms_output.put_line('blabla'||cas_aktual||'konec');
      6  end;
      7  /
    blabla300720081207konec
    PL/SQL procedure successfully completed.
    test@ora>
    test@ora> spool OFF
    test@ora>
    test@ora> host type c:\test.log
    test@ora>
    test@ora> declare cas_aktual VARCHAR(12);
      2  begin
      3  select to_char(sysdate,'ddmmyyyyHH24MM') into cas_aktual from dual;
      4  dbms_output.enable;
      5  dbms_output.put_line('blabla'||cas_aktual||'konec');
      6  end;
      7  /
    blabla300720081207konec
    PL/SQL procedure successfully completed.
    test@ora>
    test@ora> spool OFF
    test@ora>
    test@ora>isotope

  • SQLPLUS commands in SQL Developer

    We are using 11g with Sql Developer. We have some script such as healthcheck etc provided by oracle support, which has SQLPLUS commands in it.
    We are not able to run those in SQL Developer. We are getting errors.
    Are there any way, we could invoke SQLPLUS shell within SQL Developer?
    Thanks in helping.

    Hi qwe16235
    SQLPLUS command failed - not enough arguments
    line 36: SQLPLUS Command Skipped: set lines 300
    line 37: SQLPLUS Command Skipped: set pages 999
    These are formatting commands we do not do yet.
    The other command seems like an error in the middle of a PL/SQL block which we should have covered, just the start of it is not enough to know what the error is.
    An example of bad pl/sql error reporting:
    input:
    show parameter error <-------------- Dummy command so the plsql block does not begin at 1
    begin <----------------starting at line 3
    broken plsql; <------------- bad plsql at line (start)3+(from ora error)2 = 5 (should be 4 - must be one off)
    end;
    output:
    NAME TYPE VALUE
    sec_protocol_error_further_action string CONTINUE
    sec_protocol_error_trace_action string TRACE
    Error starting at line 3 in command:
    begin
    broken plsql;
    end;
    Error report:
    ORA-06550: line 2, column 8:
    PLS-00103: Encountered the symbol "PLSQL" when expecting one of the following:
    := . ( @ % ;
    The symbol ":=" was substituted for "PLSQL" to continue.
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    -Turloch
    SQLDeveloper team

  • Sqlplus fails to start, halting Ora10g install on WinXP

    Hello,
    I've been trying to install Oracle 10g 10.2.0.1 on Windows XP SP2 all day. The problem is, sqlplus crashes (creating a Windows app crash dialog) during the Oracle Database Configuration Assistant step. Clicking "Don't Send" on the crash window will simply create another "SQL*PLUS has encountered a problem and needs to close" error. In other words, I can't escape the sqlplus crash, as it appears that the installer won't rest until it runs sqlplus.
    Note that I have tried to run sqlplus from the command line during this process, and I receive the same crash notice.
    The installActions log file contains this at the end:
    INFO: Configuration assistant "Oracle Net Configuration Assistant" succeeded
    INFO: Command = C:\WINDOWS\system32\cmd /c call D:\oracle\product\10.2.0\db_1/bin/dbca.bat -progress_only -createDatabase -templateName General_Purpose.dbc -gdbName orcl10g -sid orcl10g -sysPassword 05a58adab13ddea6492d53596ff8af9327 -systemPassword 05a58adab13ddea6492d53596ff8af9327 -sysmanPassword 05a58adab13ddea6492d53596ff8af9327 -dbsnmpPassword 05a58adab13ddea6492d53596ff8af9327 -emConfiguration LOCAL -datafileJarLocation D:\oracle\product\10.2.0\db_1\assistants\dbca\templates -datafileDestination D:\oracle\product\10.2.0\oradata -responseFile NO_VALUE -characterset WE8MSWIN1252 -obfuscatedPasswords true -sampleSchema true -recoveryAreaDestination NO_VALUE
    The error in the Windows Event Log is this:
    Faulting application sqlplus.exe, version 0.0.0.0, faulting module unknown, version 0.0.0.0, fault address 0x00000000.
    I'm not sure what else to include, please let me know what else you might need.
    Thanks for your help. I've tried many different paths through the installer, always running into this same problem. Any advice on how to get past this sqlplus crash would be greatly appreciated.
    Thanks very much,
    Seth

    Hello,
    I did not have any problem setting up 2 different oracle versions on one Windows machine.
    a) First I installed 10g R2 with a default database ORCL
    Oracle_Home = d:\oracle\oracle10g
    b) Second I did install 9i with a default database JUNK
    Oracle_Home = c:\oracle\oracle9i
    I configured listener.ora from 10g home for the above mentioned 2 databases.
    << listener.ora>>
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = xasers)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = xasers)(PORT = 1522))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = D:\oracle\oracle10g)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = ORCL)
    (ORACLE_HOME = D:\oracle\oracle10g)
    (SID_NAME = ORCL)
    (SID_DESC =
    (GLOBAL_DBNAME = JUNK)
    (ORACLE_HOME = c:\oracle\oracle9i)
    (SID_NAME = JUNK)
    << Tnsnames.ora 10g>>
    JUNK =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xasers)(PORT = 1522))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = JUNK)
    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xasers)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORCL)
    << Tnsnames.ora 9i>>
    JUNK =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xasers)(PORT = 1522))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = JUNK)
    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = xasers)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORCL)
    << Sqlnet.ora 9i/10g>>
    SQLNET.AUTHENTICATION_SERVICES= (NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    << tnsping>>
    TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 03-MAR-2006 14:36:56
    Copyright (c) 1997, 2005, Oracle. All rights reserved.
    Used parameter files:
    D:\oracle\oracle10g\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xasers)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL)))
    OK (20 msec)
    TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 03-MAR-2006 14:37:02
    Copyright (c) 1997, 2005, Oracle. All rights reserved.
    Used parameter files:
    D:\oracle\oracle10g\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xasers)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = JUNK)))
    OK (20 msec)
    << Sqlplus 9i >>
    SQL*Plus: Release 9.2.0.1.0 - Production on Fri Mar 3 14:27:41 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Enter password: **********
    Connected to:
    Oracle9i Release 9.2.0.1.0 - Production
    JServer Release 9.2.0.1.0 - Production
    SQL> select name from V$database;
    NAME
    JUNK
    SQL> show release
    release 902000100
    << Sqlplus 10g>>
    SQL*Plus: Release 9.2.0.1.0 - Production on Fri Mar 3 14:27:55 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Enter password: **********
    Connected to:
    Oracle Database 10g Release 10.2.0.1.0 - Production
    SQL> select name from V$database;
    NAME
    ORCL
    SQL> show release
    release 1002000100
    I did not see any issues in installation and setup listener having different homes and different versions. I guess your installation got messed up.
    -Sri
    Message was edited by:
    Srikanth Pulikonda

  • Getting sqlplus and odbc connection to work

    I'm looking to automate some data extraction activities either through a windows batch file or set up a data connection in an excel spreadsheet. I've installed (I think) the instant client, but, I'm not seeing any programs to run in my start>All Programs list except Microsoft ODBC Administrator and sqlplus does not work when typed at the command prompt (sqlplusw neither).
    Not sure what I should do next...thanks for looking and your help.
    I currently use sql server and access and have set odbc connections and connections to sql server in excel.
    Here's what the inventory shows:
    Inventory contents of (my-computer):
    Oracle Homes
    OraClient10g_home1
    Oracle Client 10.2.0.1.0
    Oracle Instant Client 10.2.0.1.0
    Oracle ODBC Driverfor Instant Client 10.2.0.1.0
    Oracle JDBC/OCI Instant Client 10.2.0.1.0
    SSL Required Support Files for InstantClient 10.2.0.1.0
    RDBMS Required Support Files for Instant Client 10.2.0.1.0
    SQL*Plus Files for Instant Client 10.2.0.1.0
    HOME SELECTION
    Central Inventory Location: "C:\Program Files\Oracle\Inventory"
    Oracle Home Status
    OraClient10g_home1 Selected
    PATH = D:\oracle\product\10.2.0\client_1\bin;D:\oracle\product\10.2.0\client_1;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
    etc, etc, etc
    --------------------------------------------------------------------------------

    thanks
    sqlplus working, had the wrong path, but, not connecting. I did save a copy of the tnsnames.ora from another machine. Here's what it shows, below, I think I need to use the LDAP adapter, but, not sure how to make it use that, sqlnet.ora is:
    SQLNET.AUTHENTICATION_SERVICES= (NTS)
    NAMES.DIRECTORY_PATH= (LDAP, TNSNAMES, EZCONNECT)
    ----command line results------
    C:\>tnsping POST_DBSR.xxx.ourcompany.COM
    TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 21-SEP-2
    010 07:33:32
    Copyright (c) 1997, 2005, Oracle. All rights reserved.
    Used parameter files:
    D:\oracle\product\10.2.0\client_2\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
    (HOST = 192.168.1.xxx)(PORT = 1521))) (CONNECT_DATA = (SID = post)))
    TNS-12535: TNS:operation timed out

  • Sqlplus and sqlldr commands getting hanged and utilizing cpu to 100%

    Hi ,
    We have a server in which only 10.2.0 client has been installed to execute some scripts in other databases. From today morning we are having problem to run sqlplus or sqlldr . whernever sqlplus or sqlplus /nolog is given it just getting hunged.

    There is no such abnormality found in the system log.
    This system has only the oracle software used as client.
    The main problem is that user is not giving me downtime to restart the server......pls help.

  • How can I retrieve values from integer array in sqlplus?

    I'm trying to write a query against OEM grid tables to come up with the result to show all scheduled backup jobs, in OEM grid, there is a table sysman.mgmt_job_schedule, one of the column DAYS is defined as TYPE SYSMAN.MGMT_JOB_INT_ARRAY AS VARRAY(5000) OF INTEGER,
    if I do select days from mgmt_job_schedule, it returns something like (2,3,4,5,,,,,,...), I want to retrieve the digits and translate them into Monday-Sunday in combination of other columns, but I'm new in varray, I don't know how can I retrieve the values in sqlplus, can you guys help me on that, My query is as follows, I got all the jobs I wanted already, just need to interpret on which day (week day) it is scheduled.
    Thanks
    select JOB_NAME, JOB_OWNER,job_type, mjs.START_TIME, DECODE(mjs.frequency_code,
    1, 'Once', 2, 'Interval', 3, 'Daily', 4, 'Weekly',
    5, 'Day of Month', 6, 'Day of Year', mjs.frequency_code) "FREQUENCY",
    mjs.days
    from mgmt_job mj, MGMT_JOB_SCHEDULE mjs
    where mj.SCHEDULE_ID=mjs.SCHEDULE_ID
    and mj.job_type='OSCommand'
    and mjs.Frequency_code in (3,4)
    and mj.is_library =0

    select job_name, job_owner, job_type, mjs.start_time,
               decode (
                    mjs.frequency_code,
                    1, 'Once',
                    2, 'Interval',
                    3, 'Daily',
                    4, 'Weekly',
                    5, 'Day of Month',
                    6, 'Day of Year',
                    mjs.frequency_code
                    "FREQUENCY", mjs.days, column_value
      from mgmt_job mj, mgmt_job_schedule mjs, table (nvl(days,sysman.mgmt_job_int_array(1,2,3,4,5,6,7)))
    where       mj.schedule_id = mjs.schedule_id
               and mj.job_type = 'OSCommand'
               and mjs.frequency_code in (3, 4)
               and mj.is_library = 0you may need to tweak the values in sysman.mgmt_job_int_array: use less or other values or simply put them null ....

  • Sqlplus exit with bind variable gives error

    Hi,
    I want to return the ID-value from an insert-statement back to the OS, but I can't catch it properly in a variable to exit that variabel. here's the script:
    variable logid NUMBER;
    select id_seq.nextval into :logid from dual;
    -- insert into Tab_A .....
    ---values :logid..... -> nothing to do with the problem
    exit :logid;
    I get this:
    SP2-0670: Internal number conversion failed
    To make a minimum test, I do:
    variable logid NUMBER;
    select 5 into :logid from dual;
    exit :logid;
    but I still get that error !
    what am I doing worng here ?
    it is a number isn't it ?
    why do i get a conversion-error than ?
    how do I fill and return a variable correctly ?
    thanks for any help, Lao De

    Your problem is with your select statement. SELECT...INTO is PL/SQL, not SQL, and can not be used to set a variable. Alternatives:
    $ sqlplus scott/tiger
    SQL*Plus: Release 9.2.0.3.0 - Production on Fri Dec 9 13:52:19 2005
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Release 9.2.0.3.0 - Production
    JServer Release 9.2.0.3.0 - Production
    SQL> variable logid number
    SQL> exec :logid := 5
    PL/SQL procedure successfully completed.
    SQL> exit :logid
    Disconnected from Oracle9i Release 9.2.0.3.0 - Production
    JServer Release 9.2.0.3.0 - Production
    $ echo $?
    5
    $ sqlplus scott/tiger
    SQL*Plus: Release 9.2.0.3.0 - Production on Fri Dec 9 13:53:39 2005
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Release 9.2.0.3.0 - Production
    JServer Release 9.2.0.3.0 - Production
    SQL> variable logid number
    SQL> begin
      2  select 6 into :logid from dual;
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> exit :logid
    Disconnected from Oracle9i Release 9.2.0.3.0 - Production
    JServer Release 9.2.0.3.0 - Production
    $ echo $?
    6Note that, on a unix platform, your return value must be a positive integer <= 255.

  • Exit with bind variable from sqlplus and then echo $?

    Hello world.
    I don't know why they are different between :v_num and the value of "echo $?"
    thanks.
    SANOWT:oratest:/data3/oratest/oratest/hgjung> cat t.sql
    select count(*) from all_objects;
    variable v_num number;
    begin
    select count(*) into :v_num from all_objects ;
    exception
    when no_data_found then
    :v_num := 1403;
    end;
    exit *:v_num*
    SANOWT:oratest:/data3/oratest/oratest/hgjung> \sqlplus scott/***** @t
    SQL*Plus: Release 10.2.0.3.0 - Production on Wed Feb 17 10:11:59 2010
    Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    COUNT(*)
    *50497*
    PL/SQL procedure successfully completed.
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SANOWT:oratest:/data3/oratest/oratest/hgjung> echo $?
    *65*
    SANOWT:oratest:/data3/oratest/oratest/hgjung>

    The $? variable in UNIX is the exit code for the program. In most *NIX versions that I am aware of, it is limited to values between 0 and 255 (i.e. one byte), so the value is truncated.  The hex value of 50497 is C541, or two bytes, so the $? variable is only getting the last byte 0X41 which is decimal 65.
    John

  • Sqlplus – spool data to a flat file

    Hi,
    Does any oracle expert here know why the sqlplus command could not spool all the data into a flat file at one time.
    I have tried below command. It seems like every time I will get different file size :(
    a) sqlplus -s $dbUser/$dbPass@$dbName <<EOF|gzip -c > ${TEMP_FILE_PATH}/${extract_file_prefix}.dat.Z
    b) sqlplus -s $dbUser/$dbPass@$dbName <<EOF>> spool.log
    set feedback off
    set trims on
    set trim on
    set feedback off
    set linesize 4000
    set pagesize 0
    whenever sqlerror exit 173;
    spool ${extract_file_prefix}.dat

    For me, this is working. What exactly are you getting and what exactly are you expecting?
    (t352104@svlipari[GEN]:/lem) $ cat test.ksh
    #!/bin/ksh
    TEMP_FILE_PATH=`pwd`
    extract_file_prefix=emp
    dbUser=t352104
    dbPass=t352104
    dbName=gen_dev
    dataFile=${TEMP_FILE_PATH}/${extract_file_prefix}.dat
    sqlplus -s $dbUser/$dbPass@$dbName <<EOF > $dataFile
    set trims on
    set trim on
    set tab off
    set linesize 7000
    SET HEAD off AUTOTRACE OFF FEEDBACK off VERIFY off ECHO off SERVEROUTPUT off term off;
    whenever sqlerror exit 173;
    SELECT *
    FROM emp ;
    exit
    EOF
    (t352104@svlipari[GEN]:/lem) $ ./test.ksh
    (t352104@svlipari[GEN]:/lem) $ echo $?
    0
    (t352104@svlipari[GEN]:/lem) $ cat emp.dat
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    (t352104@svlipari[GEN]:/lem) $

  • Call PL/SQL Procedure (not stored) from SQLPLUS

    Hello,
    the following code creates a stored procedure and allows to call the procedure from SQLPLUS using EXEC.
    CREATE or REPLACE PROCEDURE welcome IS
    BEGIN
        dbms_output.put_line('Welcome user ' || user);
    END;
    exec welcome;I would like to do the same without storing the procedure. The procedure should be defined in an PL/SQL-Script and called in a SQLPLUS loop. On the one hand I do not have the privileges to create stored procdures. On the other hand I want to use put_line in the loop. Without passing control to SQLPLUS (e.g. the loop-master) all output is kept in the buffer and no information are shown during processing the data.
    Regards, Rainer

    netaktiv wrote:
    There should be a repair job updating many hundredthousends records. A script should be created and called only once and the calling user should be informed about the processing status. There is no need for heavy output, but after 5000 or 10000 records I would like to display a message saying nnnnn records processed.Then you need another mechanism to report the current status to the user.
    You cannot use the current session to do that. Sessions are serialised. That means they can do only service a single request at a time. So if the session executes procedure foo that updates 100's of 1000's of rows - then that is what the process will be doing. The procedure can only report back to the client after it has completed. It cannot interact directly with the client during the executing of that procedure.
    This means that if you want to actually send a notification to the client, you need to do that via a separate session. E.g. the 1st session executes procedure foo that performs the update. That procedure sends a notification (using DBMS_ALERT or DBMS_PIPE for example) to the 2nd session - where the 2nd session receives the asynchronous notification and reports that to the user.
    Another method would be for the update procedure to register a long operation using DBMS_APPLICATION_INFO. This enables another session to view the status and progress of the update procedure via virtual (v$) performance views.
    Another method would be for the client session not to start the update procedure itself. Instead it can schedule a background job (using DBMS_JPB or DBMS_SCHEDULER interfaces) - and then monitor the status of the job.
    Also suggest that you spend some time familiarising yourself with application developer fundamentals and concepts for Oracle. There are guides for both at http://tahiti.orcacle.com for the Oracle version you use. You cannot correctly use Oracle if you do not understand how Oracle works and what the application development features are. And your current approach using DBMS_OUTPUT is pretty much flawed and not how Oracle sessions should report their processing status to a client.

  • Reference value of an SQLPLUS variable in a PL/SQL anonymous block

    All,
    Is there a way of referencing an SQLPLUS variable within a PL/SQL anonymous block. See my example below........
    sqlplus -s /@${L_DB_SID} <<-ENDOFSQL >> ${L_LOGFILE}
    SET FEEDBACK OFF
    SET PAGES 0
    SET SERVEROUTPUT ON
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    WHENEVER OSERROR EXIT 2
    VARIABLE l_ret_sts NUMBER;
    VARIABLE l_ret_msg VARCHAR2(300);
    exec sh_plsql_owner.sh\$secure_batch.p\$set_role(p_ret_sts => :l_ret_sts);
    begin
    if :l_ret_sts > 0 then
    dbms_output.put_line('l_ret_sts:'||:l_ret_sts||':SECURITY');
    else
    ${L_PLSQL_PROG}(p_ret_type => 0, p_ret_sts => :l_ret_sts, p_ret_msg => :l_ret_msg);
    dbms_output.put_line('l_ret_sts:'||NVL(:l_ret_sts,0));
    dbms_output.put_line('l_ret_msg:'||:l_ret_msg);
    end if;
    end;
    exit
    ENDOFSQL
    I need to be able to reference :l_ret_sts in the begin block using the if statement "if :l_ret_sts > 0 then"
    :l_ret_sts is populated in a procedure call beforehand.
    However it seems as though the begin block cannot reference the value returned to :l_ret_sts.
    Any ideas.
    Ian.

    Managed to solve this. I put my call to the package that the role enables via dynamic sql....
    sqlplus -s /@${L_DB_SID} <<-ENDOFSQL >> ${L_LOGFILE}
    SET FEEDBACK OFF
    SET PAGES 0
    SET SERVEROUTPUT ON
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    WHENEVER OSERROR EXIT 2
    VARIABLE l_ret_sts NUMBER;
    VARIABLE l_ret_msg VARCHAR2(300);
    exec dbms_application_info.set_client_info('CONTROL-M');
    exec sh_plsql_owner.sh\$secure_batch.p\$set_role(p_ret_sts => :l_ret_sts);
    declare
    v_text varchar2(500);
    begin
    if :l_ret_sts > 0 then
    dbms_output.put_line('l_ret_sts:'||:l_ret_sts||':SECURITY');
    else
    v_text := 'begin ${L_PLSQL_PROG}(p_ret_type => 0, p_ret_sts => :1, p_ret_msg => :2);end;';
    execute immediate v_text using in out :l_ret_sts, in out :l_ret_msg;
    dbms_output.put_line('l_ret_sts:'||NVL(:l_ret_sts,0));
    dbms_output.put_line('l_ret_msg:'||:l_ret_msg);
    end if;
    end;
    exit
    ENDOFSQL
    Cheers
    Ian.

  • I*sqlplus: Internal error (no valid library could be found)

    Hello
    I have installed Oracle 8.1.7 on Windows NT
    and Oracle 8.1.7 on Sun Sparc Solaris.
    On Windows NT, I have installed i*sqlplus.
    However, when connecting from browser
    in the index file
    I've given a valid username/password of
    a database in Oracle 8.1.7 on Sun Sparc
    and a connect string to the database
    on Oracle 8.1.7 on Sun Sparc.
    This connect string is created using
    Net 8 assistant and this connect string
    is on the Windows NT with Oracle 8.1.7.
    However, instead of connecting I
    am getting the error
    Internal error : (no valid library could be found)
    Can you please help me?
    Thanks

    Cyril,
    Can you connect to the database using the command line version of SQL*Plus? If so, you're using the correct syntax.
    It sounds like iSQL*Plus is not set up correctly. Do you have the necessary 8.1.7 components on the NT machine (Oracle HTTP Server, Net8, SQL*Plus)?
    Review the installation documentation, and/or post more specific information on your set up.
    Alison
    iSQL*Plus Team

  • Problem with sqlplus with whitespace in the path of the @ command

    I'm running Oracle 11g on Linux and I'm trying to run a script which will create my database. This script runs fine on windows, but when I test it on Linux, I get the following error:
    SP2-0556: Invalid File NameThe problem may be that the path to the file name has a space in it. I'm going to simplify the problem down to one of the many commands I run in the file to make it simple. The sample command I'm trying to run looks like this:
    sqlplus [uname]/[pw] @'../database/My Schema/create_sequence.sql'the create_sequence.sql file has two simple create sequence commands that run fine by themselves. I strongly suspect it is due to the white space because when I change the directory name from My Schema to MySchema and alter the above sqlplus command accordingly, the script runs fine.
    Like I said, this script works in windows with the spaces, but not in Linux. I suspect spaces may not be supported, but I was wondering if anyone knew any different or it there is a work-around?
    side note: running a command like:
    more ../database/My\ Schema/create_sequence.sqlor
    more '../database/My Schema/create_sequence.sql'prints the contents of the file to the console as you would expect. So, I think this is sqlplus (and linux) specific.
    Edited by: user10887698 on Jul 28, 2009 4:21 PM
    code markup!!!

    user10887698 wrote:
    I'm running Oracle 11g on Linux ...
    ..when I change the directory name from My Schema to MySchema and alter the above sqlplus command accordingly, the script runs fine.i really can't see why you are considering this as a problem.
    On linux, you can't create directory that contains spaces between letters, like let say : fol der. Doing a mkdir fol der would create two folders,
    one named fol and the other named der.
    By information you provided , it's obvious that the exact and the correct full path to the create_sequence.sql file is ...database/MySchema/create_sequence.sql.
    Can you position yourself in the directory where create_sequence.sql file is and type pwd to confirm the correct path?

Maybe you are looking for