Package fails, execute in sql*plus works

SQL> execute toa.toa_security.change_password('testuser','testpassword');
ALTER USER testuser IDENTIFIED BY testpassword
BEGIN toa.toa_security.change_password('testuser','testpassword'); END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "TOA.TOA_SECURITY", line 77
ORA-06512: at line 1
Here is the code
PROCEDURE CHANGE_PASSWORD (userid VARCHAR2, passwd VARCHAR2) IS
  sqlstr VARCHAR2(500);
BEGIN
  sqlstr :=
    'ALTER USER '||userid||' IDENTIFIED BY '||passwd;
  EXECUTE IMMEDIATE sqlstr;
END CHANGE_PASSWORD;Line 77: EXECUTE IMMEDIATE sqlstr;
No matter what user I run this as it fails (even the owner who has DBA priv). I have other procedures and functions in this package and they all run fine for the owner and a "simple" user. So obvioulsy it is not a privilege missing for the user on the package even though I did "grant execute on toa_security to <user>;".
I'm stumpped and baffled. And, I'm probably blind as to what is wrong.
Any ideas?

What William Robertson said is correct. Here's what happened on my system, I had to grant ALTER USER to myself directly:
SQL> show user
USER is "SYSTEM"
SQL> CREATE OR REPLACE
  2  PROCEDURE CHANGE_PASSWORD (userid VARCHAR2, passwd VARCHAR2) IS
  3
  4  BEGIN
  5
  6    EXECUTE IMMEDIATE 'ALTER USER '||userid||' IDENTIFIED BY '||passwd;
  7
  8  END CHANGE_PASSWORD;
  9  /
Procedure created.
SQL> exec change_password('HR','blah');
BEGIN change_password('HR','blah'); END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYSTEM.CHANGE_PASSWORD", line 5
ORA-06512: at line 1
SQL> grant alter user to system;
Grant succeeded.
SQL> exec change_password('HR','blah');
PL/SQL procedure successfully completed.
SQL> conn hr/blah
Connected.
SQL>

Similar Messages

  • Patch 7303030  FAILED: file cst4274743.sql on worker  1 for product bom use

    Hello
    I'm a noob to the Oracle world, and are trying to update our system from 12.0.4 to 12.1.3 I got to the point of installing patch 7303030 and I keep get this FAILED: file cst4274743.sql on worker 1 for product bom username BOM. I have looked in the threads but have not found anything that has helped so far. I have tried restarting the worker but got the same result. can any one point me in some direct so i can complete my update in my test environment.
    Thanks

    Hello
    I'm a noob to the Oracle world, and are trying to update our system from 12.0.4 to 12.1.3 I got to the point of installing patch 7303030 and I keep get this FAILED: file cst4274743.sql on worker 1 for product bom username BOM. I have looked in the threads but have not found anything that has helped so far. I have tried restarting the worker but got the same result. can any one point me in some direct so i can complete my update in my test environment.
    Thanks

  • Select from in SQL Developer fails - SQL*Plus works

    Hello All,
    I've got the HS connection to MySLQ working correctly and most of the requirements I have with respect to the data is working.
    However, i"m only able to test my procedures and functions in SQL*PLus. IN SQL Developer 4.0.0.12 there is always a problem and query results are never displayed.
    Thanks in advance for any advice.
    Sincerely
    JS

    Actually Mike,
    The white spaces are appended to the end of the resulting string. I've included the NLS setting for bother Oracle adn MySQL as well as my odbc.ini file
    select '"'|| "User" ||'"' as Username from "user"@MYODBC5;
    Results (there is white spaces added right after the username, as the result shoudl have been "intm","root" as opposed to "intm                                "
    ===============================================================================================================
    USERNAME
    "intm
    USERNAME
    "root
    NLS _SETTINGS  ORACLE
    ==============================================================
    Oracle:
    ======
    NAME                      
    VALUE$
    NLS_LANGUAGE              
    AMERICAN
    NLS_TERRITORY             
    AMERICA
    NLS_CURRENCY              
    $
    NLS_ISO_CURRENCY          
    AMERICA
    NLS_NUMERIC_CHARACTERS    
    NLS_CHARACTERSET          
    AL32UTF8
    NLS_CALENDAR              
    GREGORIAN
    NLS_DATE_FORMAT           
    DD-MON-RR
    NLS_DATE_LANGUAGE         
    AMERICAN
    NLS_SORT                  
    BINARY
    NLS_TIME_FORMAT           
    HH.MI.SSXFF AM
    NAME                      
    VALUE$
    NLS_TIMESTAMP_FORMAT      
    DD-MON-RR HH.MI.SSXF
    F AM
    NLS_TIME_TZ_FORMAT        
    HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT   
    DD-MON-RR HH.MI.SSXF
    F AM TZR
    NLS_DUAL_CURRENCY         
    $
    NLS_COMP                  
    BINARY
    NLS_LENGTH_SEMANTICS      
    BYTE
    NLS_NCHAR_CONV_EXCP       
    FALSE
    NAME                      
    VALUE$
    NLS_NCHAR_CHARACTERSET    
    AL16UTF16
    NLS_RDBMS_VERSION         
    11.2.0.2.0
    NLS _SETTINGS  MYSQL
    ==============================================================
    Oracle:
    ======
    NAME :
    +--------------------------+----------------------------+
    | Variable_name            | Value                      |
    +--------------------------+----------------------------+
    | character_set_client     | utf8                       |
    | character_set_connection | utf8                       |
    | character_set_database   | latin1                     |
    | character_set_filesystem | binary                     |
    | character_set_results    | utf8                       |
    | character_set_server     | latin1                     |
    | character_set_system     | utf8                       |
    | character_sets_dir       | /usr/share/mysql/charsets/ |
    +--------------------------+----------------------------+
    ===========================================================ODBC INI
    [myodbc5]
    Driver = /usr/lib64/libmyodbc5a.so
    Description = Connector/ODBC 5.3.4 Driver DSN
    SERVER = 127.0.0.1
    PORT = 3306
    USER = intm
    PASSWORD = *********
    DATABASE = mysql
    OPTION = 0
    TRACE = OFF

  • Enterprise manager configuration failed but i*SQL Plus runs fine

    While Installing Oracle database 10g rel 2 on windows XP professional Service Pack 2 The Enterprise manager configuration failed.
    However I*SQL plus and
    Datbase configuration assistant and other tools run fine.
    I got the following error message
    Error instantiating em configuration files.
    Refer log E:\oracle\product\10.2.0\db_1\cfgtoollogs\dbca\orcl\emConfig.log for more details.
    On checking the contents of the log file I saw the following enteries
    Creating directories...
    Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.util.PlatformInterface executeCommand
    CONFIG: Unable to copy E:\oracle\product\10.2.0\db_1/sysman/config/emomsintg.xml to E:\oracle\product\10.2.0\db_1\localhost_orcl/sysman/config/emomsintg.xml: No such file or directory at bin/EMDeploy.pm line 261.
    Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.util.PlatformInterface executeCommand
    WARNING: Error executing CMD /C E:\oracle\product\10.2.0\db_1\bin\emctl.bat deploy dbconsole E:\oracle\product\10.2.0\db_1\localhost_orcl localhost:3938 localhost orcl
    Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.EMAgentConfig instantiateEMConfigFiles
    CONFIG: Failed to deploy state dirs
    Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.EMConfig perform
    SEVERE: Error instantiating EM configuration files
    Refer to the log file at E:\oracle\product\10.2.0\db_1\cfgtoollogs\dbca\orcl\emConfig.log for more details.
    Apr 14, 2007 2:24:45 PM oracle.sysman.emcp.EMConfig perform
    CONFIG: Stack Trace:
    oracle.sysman.emcp.exception.EMConfigException: Error instantiating EM configuration files
    at oracle.sysman.emcp.EMAgentConfig.updateAgentConfigFiles(EMAgentConfig.java:2560)
    at oracle.sysman.emcp.EMAgentConfig.performConfiguration(EMAgentConfig.java:1166)
    at oracle.sysman.emcp.EMAgentConfig.invoke(EMAgentConfig.java:207)
    at oracle.sysman.emcp.EMAgentConfig.invoke(EMAgentConfig.java:185)
    at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:146)
    at oracle.sysman.assistants.util.em.EMConfiguration.run(EMConfiguration.java:430)
    at java.lang.Thread.run(Thread.java:534)
    Can anybody suggest me a workaround.
    Is this an open bug?

    worth running emca -deconfig dbcontrol db and then running emca -configure dbcontrol db to let it have another try.

  • ORA-12154: TNS:could not resolve... - sql plus works, env vars are set...

    Hi,
    I am getting this error message in my ASP.Net apps (namespace Oracle.DataAccess.Client) and any app that tries to use the Oracle Provider for OLE DB.
    Error:
    ORA-12154: TNS:could not resolve the connect identifier specified
    Here is what I do know:
    - My ORACLE_HOME is set to C:\oracle\product\11.1.0\client_1\
    - My path has C:\oracle\product\11.1.0\client_1\network\admin;C:\oracle\product\11.1.0\client_1\bin;
    - I installed Oracle Client 11g, previously 10g was working but one of the devs wanted to upgrade
    - I can connect using sqlplus user/pass@tnsname
    - I can test tns entries successfully in Net Manager
    Here is what I don't know:
    - When using OLE connections, why does Oracle Provider for OLE DB not pick up on the environment variables - sql plus seems to, that's why it works.
    - In ASP.Net, why does the connection object from Oracle.DataAccess.Client not pick up the correct environment variables?
    - How do the Oracle drivers pick up the location of the TNS names?
    Thanks,
    Michael
    Edited by: user2750352 on 04-May-2009 07:51

    Hi,
    What "environment variables" are you referring to that you have set? You shouldnt have to set any, unless you're talking about TNS_ADMIN just to avoid having to configure multiple TNSNames.ora's if you have multiple homes.
    Your PATH doesnt need to include OH\network\admin, but thats not hurting anything. PATH is for dll loading, not for finding config files.
    Do you still have 10g installed? When you connect using sqlplus user/pass@tnsname, are you using 11g sqlplus? Or is that coming from the 10g client? Multiple homes arent aware of each other, so if you have a 10g home and an 11g home, you'd have to configure tnsnames.ora for both (or use tns_admin).
    As far as I know, the client software picks up tnsnames.ora by checking:
    1) the local working directory
    2) the tns_admin directory
    3) the network\admin directory of the client home being used.
    Hope it helps,
    Greg

  • This Query IS giving divide by zero error when executed in sql plus

    UPDATE grn G
    SET g.OPT_WA_FAIR_VAL_A = (SELECT
    ROUND(SUM(NVL(ga.OPT_FAIR_VAL_A, 0) * NVL(gvs.GRN_VEST_OPT_Q, 0)) / SUM(NVL(gvs.GRN_VEST_OPT_Q, 0)), 6)
    FROM
    GRANT_VESTING_SCHEDULE gvs,
    GRANT_ASSUMPTION ga
    WHERE
    gvs.ORG_GRP_I = ga.ORG_GRP_I AND
    gvs.grn_n = ga.grn_n AND
    ga.ORG_GRP_I = g.ORG_GRP_I AND
    ga.GRN_N = g.GRN_N AND
    NVL(ga.GRN_ASMPN_EFF_D, gvs.grn_vest_d) <= gvs.grn_vest_d AND
    NVL(ga.GRN_ASMPN_END_D, gvs.grn_vest_d) >= gvs.grn_vest_d
    WHERE G.ORG_GRP_I =5
    Any suggestions

    hi
    What should be result if divide by zero e.g
    SQL> SELECT * FROM emp;
        EMPNO ENAME        JOB             MGR HIREDATE        SAL      COMM    DEPTNO
         7901 SMITH        CLERK          7902 17-DEC-80         0         0        20
         7499 ALLEN        SALESMAN       7698 20-FEB-81      2100      1800        30
         7521 WARD         SALESMAN       7698 22-FEB-81      2300      2000        30
         7566 JONES        MANAGER        7839 02-APR-81      1000      3000        20
         7654 MARTIN       SALESMAN       7698 28-SEP-81      3200       700        30
         7698 BLAKE        MANAGER        7839 01-MAY-81      1000      3000        30
         7782 CLARK        MANAGER        7839 09-JUN-81      1000      3000        10
         7788 SCOTT        ANALYST        7566 19-APR-87      1000      1900        20
         7839 KING         PRESIDENT           17-NOV-81      1000      1700        10
         7844 TURNER       SALESMAN       7698 08-SEP-81      1800       700        30
         7876 ADAMS        CLERK          7788 23-MAY-87      1000      1300        20
         7900 JAMES        MANAGER        7698 03-DEC-81      1000      3000        30
         7902 FORD         ANALYST        7566 03-DEC-81      1000      2000        20
    13 rows selected.
    SQL> SELECT sal/DECODE(comm,0,1,comm) FROM emp;
    SAL/DECODE(COMM,0,1,COMM)
                            0
                    1.1666667
                         1.15
                    .33333333
                    4.5714286
                    .33333333
                    .33333333
                    .52631579
                    .58823529
                    2.5714286
                    .76923077
                    .33333333
                           .5
    13 rows selected.Khurram

  • SQL*Plus crash due to PL/SQL package compilation

    The problem:
    SQL*Plus crash due to creation large PL/SQL with windows dump error.
    But if insert that package using for example ToAD it works fine.
    The solution:
    I have increased processes parameter in spfile from 40 up to 400. I think it is no need to increase the parameter to such large value, but this value is works.

    emss wrote:
    Can a .sql sql*plus script be called from a pl/sql package? I so, can someone provide a brief example?Not really - there is no easy interface.
    There are interfaces that are not easy. You could instead
    * use DBMS_SCHEDULER to create a host call to execute an OS script to execute the SQL*PLUS script
    * use a java stored procedure to do the same thing
    Do a web search to find examples

  • How to execute a mapping in sql plus?

    hi,
    OWB generate a package code from the mapping, for example if I have a package named map1, what is the request to execute ,in SQL
    PLUS, map1.main() which is the function main of this package?
    Thank you

    Hi
    There is a MAIN procedure you can use, if you have no mapping input parameters defined it will be like;
    PROCEDURE Main(p_status OUT VARCHAR2,
    p_max_no_of_errors IN VARCHAR2 DEFAULT NULL,
    p_commit_frequency IN VARCHAR2 DEFAULT NULL,
    p_operating_mode IN VARCHAR2 DEFAULT NULL,
    p_bulk_size IN VARCHAR2 DEFAULT NULL,
    p_audit_level IN VARCHAR2 DEFAULT NULL,
    p_purge_group IN VARCHAR2 DEFAULT NULL,
    p_job_audit IN VARCHAR2 DEFAULT 'TRUE');
    If you define mapping input parameters they will also be included in the signature of this procedure.
    See this post here for some details;
    http://blogs.oracle.com/warehousebuilder/2008/11/using_3rd_party_schedulers_with_owb_1.html
    Cheers
    David

  • How to exit from SQL*Plus based on the return value of a SQL select stment?

    Hi
    I have a SQL script executed from SQL*Plus. I would like to know if SQL*Plus
    supports any kind of branching or exiting from script execution based on a
    returned value of a SQL select statement. I am on 9i.
    Regards,
    Tamas Szecsy

    in sqlplus, you have whenever
    ex:
    whenever sqlerror exit failure
    insert into ...
    -- if this fails, then you will be out
    insert into ...
    -- if this fails, then you will be out
    whenever sqlerror continue
    insert into ...
    -- if this fails, this continues
    insert into ...and you have PL/SQL
    declare x number;
    begin
    select count(*) into x from emp;
    if (x=14) then null; end if;
    end;
    /note that you can mix those in some case
    -- exit if there is no row in emp
    whenever sqlerror exit 1
    var dummy number
    exec select count(*) into :dummy from emp having count(*)!=0

  • Refcursor not returning rows when called from non SQL*Plus IDE or other

    Hi all,
    I have a very weird problem.
    We have recently performed a minor upgrade to our oracle database and are now using:
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for Linux: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    5 rows selected.We have a crystal report selecting data from a refcursor returned by a stored procedure.
    The stored procedure updates data when called as well as returning the refcursor in question.
    Observe the following test scenario executed in SQL*Plus:
    SQL> create table testtab (teststr varchar2(100));
    Table created.
    Elapsed: 00:00:00.00
    SQL> insert into testtab values ('X');
    1 row created.
    Elapsed: 00:00:00.00
    SQL> create or replace procedure testtabproc (p_listcur in out sys_refcursor)
      2  as
      3  begin
      4 
      5     open p_listcur for
      6        select *
      7          from testtab
      8         where teststr = 'X';
      9 
    10 
    11     update testtab
    12        set teststr = 'Y';
    13 
    14        commit;
    15 
    16  end;
    17  /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> declare
      2 
      3  v_list_cur sys_refcursor;
      4 
      5  type t_out_rec is record (teststr varchar2(100) );
      6 
      7 
      8 
      9  v_out_rec t_out_rec;
    10 
    11  v_rec_count   number := 0;
    12  v_count_limit number := 10000;
    13 
    14  begin
    15 
    16  dbms_output.put_line('about to call proc');
    17
    18  testtabproc(v_list_cur);
    19 
    20  dbms_output.put_line('about to fetch records');
    21 
    22  fetch v_list_cur into v_out_rec;
    23  while v_list_cur%found loop
    24     v_rec_count := v_rec_count + 1;
    25     if v_rec_count <= v_count_limit then
    26       dbms_output.put_line(v_out_rec.teststr);
    27     end if;
    28  fetch v_list_cur into v_out_rec;
    29  end loop;
    30  dbms_output.put_line('complete. selected '||v_rec_count||' records.');
    31 
    32 
    33  end;
    34  /
    about to call proc                                                                                                                 
    about to fetch records                                                                                                             
    X                                                                                                                                  
    complete. selected 1 records.                                                                                                      
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> select * from testtab;
    TESTSTR
    Y
    1 row selected.
    Elapsed: 00:00:00.00
    SQL> as you can see, the cursor returns data and the table is updated.
    now, our problem is with crystal and also when I use the same test case via another IDE like TOAD.
    No data is returned from the list but the table is still updated.
    We suspect that something is happening that is causing the table to be updated before the refcursor is opened, or at least before the predicates are applied.
    has anyone else encountered this problem before?

    Tubby wrote:
    WhiteHat wrote:
    nope - it works from sqlplus itermitantly (i.e. we always get the debug output but the cursor only sometimes fetches the rows).
    it is almost as if the commit is being executed before the cursor is opened.
    I still havn't been able to reproduce it except with the actual scenario that I am working with...Is the code you are dealing with exactly the same as the skeleton you've posted in your original post? Do you perhaps have a generic exception catcher in there somewhere (perhaps catching and hiding an ORA-01555) when the cursor is being fetched?
    Not that i expect it to make any difference, but i'm curious as to why you've declared your cursor as IN / OUT ?
    p_listcur in out sys_refcursor
    the code structure in the real example is almost identical to that test case I produced - the exception handler is only catering for no_data_found, all other errors should be raised as normal.
    edit: sorry I forgot to add - it's in/out because apparently that's what crystal reports needs in order to use the refcursor..... I'm not a crystal guy so I can't be any more specific than that sorry......
    Edited by: WhiteHat on Oct 11, 2010 9:34 AM

  • SQL*Plus: Comment appears in Default-Column

    Please look at this commands, executed in SQL*Plus (Oracle 10g):
    create table t1 (
    c1 number,
    c2 number default 0 -- comment in sqlplus
    select column_name,data_default from all_tab_columns where table_name='T1';
    COLUMN_NAME                    DATA_DEFAULT
    C1
    C2                             0 -- comment in sqlplus
    The comment is stored in the data dictionary! ?:|
    insert into t1 (c1) values (0);
    commit;
    But the default clause works:
    select c1,c2 from t1;
    C1        C2
    +0 0+
    Is it a bug or is it a feature???
    Greetings from Germany
    Wolfgang

    From: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_constraints.htm#sthref626
    Setting Default Column Values
    Default values can be defined using any literal
    Bug or feature?
    It depends on how literal you interprete literals?
    !http://www.designer-daily.com/wp-content/uploads/2009/06/bug-feature.jpg!

  • POL-8000 with SQL*Plus

    Hi,
    I need to be able to load some classes and procedure definitions into a 9i Lite db on client machines that do not have msql installed, so I've written a script and I'm testing it against SQL*Plus 8.x. I get "[POL-8000] could not start the Java Virtual Machine" as soon as "create java class ..." is executed. The docs say to ensure that javai.dll is in the PATH (which it is).
    Any ideas/suggestions?
    Regards
    Andy

    Martin,
    SQL*Plus works fine with Olite in all other respects and, as I said, the target client machines will not have msql installed on them, so I decided to load the classes via jdbc calls. Works just fine.
    Thanks for your reply.
    Regards
    Andy

  • IF statement in SQL*Plus - how to do it

    Hi,
    In SQL*Plus script, I would like to keep conditional checking (IF statement) and proceed. For example, whatever is done in PL/SQL block below, want to do the same in SQL*Plus script, I know partly it can be done using VARIABLE keyword, conditional checking can be done using DECODE in SELECT statement, but I want to carry out a more complex requirement, hence I want to use IF statement somehow in SQL*Plus.
    Another question, how to do spooling in PL/SQL script, it can be done using UTL_FILE, any other option is there to achieve this.
    declare
    v_ind_count int;
    begin
    select count(1) into v_ind_count from user_indexes where index_name = 'index_object_name';
    IF v_ind_count > 0
    THEN
    dbms_output.put_line('index found');
    ELSE
    dbms_output.put_line('index does not exist');
    END IF;
    end;
    /

    Hello,
    SQL*PLUS has no scripting language. It can only execute SQL and PL/SQL scripts. There are some commands like SPOOL or SET but no commands for conditional statements. You should describe your requirements, maybe we can find a way.
    Or you can search the forum, maybe your question has already been answered
    [Google for SQL*PLUS + condition|https://www.google.de/search?q=site%3Aforums.oracle.com+"SQL*PLUS"+condition]
    # {message:id=4189517}
    # {message:id=4105290}
    how to do spooling in PL/SQL scriptFrom within PL/SQL you can use dbms_output, the spool has to be started by the calling SQL script when it is executed in SQL*PLUS. Or you can use utl_file, but then you can only write to a server directory, not into a client file. To give an advice we need more information about what you want to do.
    Regards
    Marcus

  • Interactive script in SQL*PLUS

    Hi,
    I am a student and we need to write a script to be executed in SQL*PLUS.
    Script has to execute an insert statement but all values need to be provided during runtime and in the end there should be a question if you wan't to save data. When yes then commit when no then rollback.
    Below is my code. Problem is that program asks for variables' values after beginning then it displays all dbms_output.put_line and then continue with pl/sql.
    I want to for examle:
    - display message 'provide date'
    - covvert string date to date type
    - when error then exit, when ok then continue
    - provide other variables in the same way
    - ask for saving.
    My code:
    SET SERVEROUTPUT ON
    set verify off
    ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD';
    declare
    do_save varchar2(240) ;
    v_ename varchar2(50);
    v_job varchar2(50);
    v_sal number;
    v_hiredate date;
    v_tmp varchar(50);
    begin
    DBMS_OUTPUT.put_line('Provide name:');
    v_tmp := '&val_ename';
    v_ename := v_tmp;
    DBMS_OUTPUT.put_line('Provide salary:');
    v_tmp := '&val_sal';
    begin
    v_sal := cast(v_tmp as number);
    exception when others then
    DBMS_OUTPUT.put_line('Incorrect salary format.');
    end;
    DBMS_OUTPUT.put_line('Provide data:');
    v_tmp := '&val_hiredate';
    begin
    v_hiredate := to_date(v_tmp);
    exception when others then
    DBMS_OUTPUT.put_line('Incorrect date format.');
    end;
    INSERT INTO EMP(ENAME, SAL, HIREDATE)
    VALUES (v_ename, v_sal, v_hiredate);
    DBMS_OUTPUT.put_line('Do you want to save? [Y/N]');
    do_save := '&val_save';
    do_save := upper(ltrim(substr(nvl(do_save, 'N'), 1,1)));
    IF do_save = 'Y' THEN
    commit;
    DBMS_OUTPUT.put_line('Data saved.');
    ELSE
    rollback;
    DBMS_OUTPUT.put_line('Data rejected.');
    END IF;
    end;
    /

    user10613699 wrote:
    it is not solving my problem,...Why not? Did you test and also check the documentation link?
    SQL> accept DO_SAVE  prompt 'Do you want to save (Y/N)? ';
    Do you want to save (Y/N)? Y
    SQL> begin
      2    if '&do_save' in ('Y','y') then
      3      commit;
      4    else
      5      rollback;
      6    end if;
      7  end;
      8  /
    old   2:   if '&do_save' in ('Y','y') then
    new   2:   if 'Y' in ('Y','y') then
    PL/SQL procedure successfully completed.
    SQL> Edited by: Sven W. on Nov 17, 2008 4:53 PM

  • Cannot log in to SQL*Plus after initial login

    Hi all,
    I have an irritating problem that I am hoping that you can help with. I installed Oracle 10g on RedHat Linux ES 3. Everything seems to be working fine as long as I do not log out my oracle user. If I leave the user logged in everything works as expected. Once I log out, when I log back in I cannot access SQL*Plus normally.
    I enter: sqlplus my_user/my_password
    I get this:
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 27 11:59:01 2005
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    ERROR:
    ORA-01034: ORACLE not available
    ORA-27123: unable to attach to shared memory segment
    Linux Error: 22: Invalid argument
    Additional information: 1
    Additional information: 360457
    But, if I enter it with the connection string: sqlplus my_user/my_password@ora1 then it works fine.
    I get the same behavior through VNC. As long as I never log out of VNC but just close the session, logging in to SQL*Plus works as normal.
    Any thoughts? My ORACLE_BASE, ORACLE_HOME, and ORACLE_SID seem to be correct.
    Thanks,
    Mike

    Hi,
    Kill the shared memory process and restart your database.
    Regards,
    Umair

Maybe you are looking for