SQL script with a prompt functionality.

Hello experts,
I tried searching this on the net but was unsucessful...
Bascially I need to update an sql script with a prompt functionality..Basically I would like a user prompt that would enter 'Yes or No' to compile invalid objects using utlrp.
If Yes, it should compile it
If No it should exit out...
Can anyone please help.. Need to do this today.
Edited by: user568296 on Oct 2, 2009 8:18 AM

Hi,
As someone suggested, you're probably better off doing this at the OS level.
SQL*Plus does not have any good mechanism for conditional branching. One trick you can do in SQL*Plus is to run one script from another by saying <tt>@@filename</tt>. By using a substitution variable (which can be defined based on the results of a query) in place of a literal filename, you can make this dynamic.
For example, the following script runs either
recompile.sql or
goodbye.sql
based on the answer to a prompt:
ACCEPT     recompile_now      PROMPT        'Do you want to recompile objects now?  '
COLUMN     next_script_col        NEW_VAL next_script
SELECT     CASE     
          WHEN  UPPER ('&recompile_now') LIKE 'Y%'
          THEN  'recompile'
          ELSE  'goodbye'
     END     AS next_script_col
FROM     dual;
@@&next_script<tt>@@filename</tt> assumes filename.sql is on the same directory as the calling script. You could also give a full path name using only one @-sign:
<tt>@pathname</tt>

Similar Messages

  • Calling a sql script file from a function.

    Hi,
    I need to call a sql script file from a user defined function. Currently i am trying to do this in Oracle SQL Developer. i tried calling with
    @ {filename}, EXECUTE IMMEDIATE etc, but nothing worked. I get the Compiler error.
    Basically my need is to call catldap.sql file so that DBMS_LDAP package gets loaded and then I can call the API functions from this.
    Please let me know if this is possible doing in a PL/SQL function.
    thanks,
    Naresh

    user784520 wrote:
    I need to call a sql script file from a user defined function. Not possible.. and it seems that you do not fully understand the client-server within the Oracle context.
    All SQL and PL/SQL are parsed and executed by an Oracle server process. The SQL and PL/SQL engines each expects a single command block at a time. Neither of these can accept a series of separate commands as a single call and then execute each in turn. The SQL engine expects a single SQL statement at a time. The PL engine expects a single PL/SQL anonymous block at a time.
    This server process also cannot break into the local file system to access script files. Nor can it hack across the network to access script files on the client.
    In order for the server process to access local files, a directory object needs to be created and the current Oracle schema needs read and/or write access on that directory object. As sound security principles apply.
    There's no PL/SQL command to execute a script. You must not mistake SQL*Plus commands (this client has a very limited vocabulary) with PL/SQL commands. SQL*Plus executes its own commands.. and send SQL and PL/SQL commands (a statement block a time) to the Oracle server process to be serviced and executed.
    It is also a very bad idea to execute external script contents from inside an Oracle server process - as that script resides externally and thus outside Oracle's security mechanisms. This means that is is pretty easy for someone to access that script, compromise it, and then have you inject and execute the contents of that script into the database.
    It is not sound security.
    Last issue - it is even worse to have application PL/SQL code dynamically creating (or trying to create) portions of the Oracle data dictionary and PL/SQL call interface.
    The database needs to be installed correctly - and this includes loading and executing the required rdbms/admin scripts during database installation. It does not make sense at all for application code to try and execute such scripts. It raises numerous issues, including having to allow that application code full and unrestricted SYS access to the database instance. A very serious security violation.
    I do not agree at all with the approach you want to use.

  • SQL script with host command job in Enterprise Manger Grid Control

    I use Enterprise Manger Grid Control 10.2.0.5 and need to create SQL script job on database instance target on unix/linux platform.
    I have problem with os command inside sqlplus script.
    For example for the simple command: SQL> host ls
    I get the message in output log: SQL> SQL> SQL> SQL> SQL> SQL> /bin/bash: ls: command not found
    Can anyone help me?
    Thank you.

    Hi,
    Make sure you have granted all necessary rights (log on as a batch job etc.) to the user used in the prefered credentials.
    Cheers,
    Kenneth

  • Is DIAdem script with Extended Classification functionality of DIAdem Professional executable by DIAdem Base?

    The Professional license adds 3D model data mapping and Extended Classification functionality to DIAdem. If I make a script that uses the 3D model data mapping functionality in DIAdem Professional it is possible to use this same script on a PC with only DIAdem Base (according to http://sine.ni.com/ds/app/doc/p/lang/nl/id/ds-263)
    Is this also true for the Extended Classification functionality? Is it possible to make a script with DIAdem Professional and execute this same script on a PC with only DIAdem Base to generate a report?
    Thanks,
    Roger

    Hi Roger,
    My understanding is that the VBScript you create that uses the extended classification function will work fine in DIAdem Base.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Running SQL Procedure with dg4msql errors: Function sequence error HY010

    I am trying to execute a stored procedure on a SQL database and get the error Function sequence error HY010.
    A simple query on a table returns teh expected result.
    I have a single Win2008R2 server with MSSQL Express 2008 and Oracle 11gR2 (32bit not 64bit version of Oracle)
    Below is the gateway init, listener and tnsnames files and the query I am trying to run:
    -- initORIONWASP.ora --
    HS_FDS_CONNECT_INFO=INGRDB//waspForGIS
    HS_FDS_TRACE_LEVEL=OFF
    HS_FDS_RECOVERY_ACCOUNT=RECOVER
    HS_FDS_RECOVERY_PWD=RECOVER
    HS_CALL_NAME=dbo.spTest;dbo.spQueryAsset;dbo.spQueryAssetDetails
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    -- Listener.ora -- (partial)
    (SID_DESC =
    (SID_NAME = ORIONWASP)
    (ORACLE_HOME = C:\Oracle\product\11.2.0\dbhome_1)
    (PROGRAM=dg4msql)
    -- tnsnames.ora -- (partial)
    ORIONWASP =
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=INGRDB)(PORT=1521))
    (CONNECT_DATA=(SID=ORIONWASP))
    (HS=OK)
    -- Simple Query --
    Running select "Asset_ID" from asset@ORIONWASP; returns the correct result
    Running select * from sys.procedures@ORIONWASP; returns a list of procedures including the procedure I want to run
    -- This pl/sql block returns the error ******* identifier 'spTest@ORIONWASP' must be declared *******
    declare
    begin
    "spTest"@ORIONWASP;
    end;
    -- This passthrough pl/sql block returns ******** [Oracle][ODBC SQL Server Driver]Function sequence error {HY010} ********
    DECLARE
    CRS BINARY_INTEGER;
    RET BINARY_INTEGER;
    v_COL1 VARCHAR2(50);
    v_COL2 VARCHAR2(50);
    BEGIN
    CRS := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@ORIONWASP;
    DBMS_HS_PASSTHROUGH.PARSE@ORIONWASP(CRS, 'exec spTest');
    BEGIN
    RET := 0;
    WHILE (TRUE)
    LOOP
    ret := DBMS_HS_PASSTHROUGH.FETCH_ROW@ORIONWASP(CRS, FALSE);
    DBMS_HS_PASSTHROUGH.GET_VALUE@ORIONWASP(CRS, 1, v_COL1);
    DBMS_HS_PASSTHROUGH.GET_VALUE@ORIONWASP(CRS, 2, v_COL2);
    DBMS_OUTPUT.PUT_Line('Col1:'||v_COL1||' Col2:'||v_COL2);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    BEGIN
    DBMS_OUTPUT.PUT_LINE('End of Fetch');
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@ORIONWASP(CRS);
    END;
    END;
    END;
    /

    The gateway configuration file contains:
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    This setting commonly causes problems and you need to set
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=FALSE
    for normal procedure calls and
    HS_FDS_PROC_IS_FUNC=FALSE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    when calling the procedure with ref cursors.
    There's a note in My Oracle Support that gives you examples how to call remote SQl Server procedures
         Note.197192.1 Different Methods How To Call MS SQL Server Procedures Using TG4MSQL - DG4MSQL
    and another one for the Sybase gateway but this code is similar for the SQL Server:
    Article-ID: Note 351400.1
    Title: How to Call a Remote Sybase Procedure Using TG4SYBS

  • Executing sql scripts with command line Sql plus

    Hello
    Well I will be gradefull if I have an answer to the follow questions
    a) How can I connect to a remote XE using sqlplus (command line)?
    for example I'm trying to connect like this : sqlplus sys/syspassw@//remoteserver:1521/xe
    and I get responce from server that I have to connect as SYSDBA or SYSOPER, so what is the proper syntax in this case?
    b) I want to execute a script file with DDL commands from Windows conscole using sqlplus. Inside this script I have the connect command and others. Is there a way to pass the name of script file as parameter to the sqlplus and execute it ? If yes what is the proper syntac from command line of Windows?
    Thank you

    There are two ways to do that...
    Either use the spool command in sqlplus, or on your command line calling sqlplus use a >> to direct the output to a file. Usually the spool is cleaner.
    It goes like this:
    spool C:\logfile.txt
    {sql commands here}
    spool off
    or
    sqlplus /nolog @sqlfile.sql >> C:\logfile.txt
    The output will be formatted slightly differently, and if you use the DOS method you won't be able to see the output as it's running.
    ~Jer

  • How to execute SQL scripts with MaxDB ..?

    Hi all,
    i got some clue from another thread and i observed the command is like
    sqlcli -d DBNAME -u SQLUSER,SQLPASS -i filename.sql -c <delimiter> is there,
    when i use this the only first query is successfully executing,
    this might be problem with delimiter.
    can any body help how to use delimiter in the script file with an example.
    thanks in advance.
    --Hari

    Hi,
    Sample Script
    CREATE TABLE city
    (zip                CHAR (5)    KEY CONSTRAINT zip BETWEEN '10000' AND '99999',
    name               CHAR(20)    NOT NULL,
    state              CHAR(2)     NOT NULL)
    CREATE TABLE customer
    (cno                FIXED (4)   KEY CONSTRAINT cno BETWEEN 1 AND 9999,
    title              CHAR (7)    CONSTRAINT title IN ('Mr', 'Mrs', 'Company'),
    firstname          CHAR (10)   ,
    name               CHAR (10)   NOT NULL,
    zip                CHAR (5)    CONSTRAINT zip BETWEEN '10000' AND '99999',
    address            CHAR (25)   NOT NULL,
    FOREIGN KEY (zip) REFERENCES city ON DELETE RESTRICT)
    \dt customer
    COMMIT
    Regards
    Ayyapparaj

  • Prompt for input from PL/SQL script.

    I have PL/SQL script running in SQL*Plus. I need to prompt for user initials (all users log-in with the same username) and make those initials part of the script.
    How do I do that?
    I know how to do it for SQL script:
    ACCEPT X PROMPT 'ENTER X: '
    select ....
    where column1 = '&X'
    But what about PL/SQL?
    Thanks a lot.
    -John

    PL/SQL is not interactive, so you can't prompt from it, but you can pass parameters :
    TEST@db102 SQL> set veri off
    TEST@db102 SQL> get inp
      1  declare
      2     p_inp   varchar2(100);
      3  begin
      4     p_inp := '&1';
      5     dbms_output.put_line(p_inp);
      6* end;
    TEST@db102 SQL> @inp PM
    PM
    PL/SQL procedure successfully completed.
    TEST@db102 SQL>                                                              

  • Running sql script from pl/sql

    Is there any standard way to run an external sql script from pl/sql
    I really appreciate any assistance.

    If you want, I did start writing a function reading and executing statements out of sql script with utl_file.
    can I issue this command in PL/SQL: EXECUTE IMMEDIATE '@filename.sql';
    the function could be extended for DDL, session setting, etc...
    Regards
    Laurent

  • Escape code for sql scripts

    Hello,
    I have a sql script with an insert statement with the character '&' in the values clause, but it always prompts me for a value.
    Does exist an escape character for the '&'?
    Thanks

    Hi,
    Add
    SET SCAN OFF
    in the begining of the SQL script.
    Regds,
    -Sreeram

  • How to load SQL scripts from a text file.

    Hi, i tried several time to load a text file/SQL script with 10 different tables and data, but 10g Express doesen't allows me to do that, any one can direct me or point out to me what i should do or do i need to adopt any special method to to get this done. i am sure there must be some thing where you can upload SQL scripts from a text file (in SQL command editor!). thanks

    Hi,
    see my other answer here:
    SQL command editor doesn't take more than 1 insert command
    This seems to be a duplicate question, right? Or am I missing something?
    Regards,
    ~Dietmar.

  • SQL Script in XE Cancels during Execution without returning any error(s)

    Hi all;
    I'm running a SQL script with a drop table and create table statement along with several hundred insert statements to load data into this table in a Oracle 10g XE database. There's a total of 213 SQL command lines in the script. (1 Drop Tbl/1 Create Tbl/211 Insert(s)).
    I run the script within the Script Editor in the Oracle XE web interface and it processes 45 of 213 of the SQL commands in the script successfully(1 Drop Tbl/1 Create Tbl/43 Insert(s)). Then the Manage Script Results screen shows a status of "Canceled". It doesn't even attempt to insert the other rows and spit back any error messages. I tried debugging by checking the consistency of the insert statements at the break point and couldn't find any discrepancy. The script just stops executing and shows this cancelled status? Can anyone help me figure out why all the lines of this script aren't being executed? I'd appreciate it a lot!
    Thanks.
    -GM

    I've spooled output to a file which I've pasted below in italic pre-tags. I abbreviated some of output to save space in this thread. I didn't want to include 600 rows showing "1 row created" 211 times with 3 spaces between each of them. So here is my abbreviated output:
    SQL> set define off;
    SQL> @\Oracle\UTC_Upload_100807.sql;
    Table tbl_UTC_HPS_Report dropped.
    Table tbl_UTC_HPS_Report created.
    211 rows created.
    SQL> describe tbl_UTC_HPS_Report;
    Name Null? Type
    STATUS VARCHAR2(255)
    CUSTOMER_NAME VARCHAR2(255)
    CUSTOMER_NUMBER VARCHAR2(255)
    LICENSE_DESCRIPTION VARCHAR2(255)
    CONTRACT_DATE VARCHAR2(30)
    CONTRACT_NUMBER VARCHAR2(255)
    QUANTITY NUMBER(5)
    INVOICE_DATE VARCHAR2(30)
    INVOICE_CCY_CODE VARCHAR2(30)
    INVOICE_NUMBER VARCHAR2(255)
    SUPPORT_PROGRAM VARCHAR2(255)
    RENEWAL_START_DATE VARCHAR2(30)
    RENEWAL_END_DATE VARCHAR2(30)
    INVOICE_AMT VARCHAR2(255)
    INSTANCE_NUMBER VARCHAR2(255)
    SQL> select * from tbl_UTC_HPS_Report;
    STATUS
    CUSTOMER_NAME
    CUSTOMER_NUMBER
    LICENSE_DESCRIPTION
    CONTRACT_DATE
    CONTRACT_NUMBER
    QUANTITY INVOICE_DATE INVOICE_CCY_CODE
    INVOICE_NUMBER
    SUPPORT_PROGRAM
    RENEWAL_START_DATE RENEWAL_END_DATE
    INVOICE_AMT
    INSTANCE_NUMBER
    ENTERED
    STATUS
    CUSTOMER_NAME
    CUSTOMER_NUMBER
    LICENSE_DESCRIPTION
    CONTRACT_DATE
    CONTRACT_NUMBER
    QUANTITY INVOICE_DATE INVOICE_CCY_CODE
    INVOICE_NUMBER
    SUPPORT_PROGRAM
    RENEWAL_START_DATE RENEWAL_END_DATE
    INVOICE_AMT
    INSTANCE_NUMBER
    United Technologies Corporation
    STATUS
    CUSTOMER_NAME
    CUSTOMER_NUMBER
    LICENSE_DESCRIPTION
    CONTRACT_DATE
    CONTRACT_NUMBER
    QUANTITY INVOICE_DATE INVOICE_CCY_CODE
    INVOICE_NUMBER
    SUPPORT_PROGRAM
    RENEWAL_START_DATE RENEWAL_END_DATE
    INVOICE_AMT
    INSTANCE_NUMBER
    The last select statement above results in continuous spitting out of column headings with no data. I've truncated it here to save space. When I go through the Oracle Database XE web front end I see that the table was created; however it says "This table has no data". So still no luck. Hope you can help. Thanks.
    -GM

  • Default Connection for SQL scripts

    Hi everybody.
    Can somebody tell me if there is a way to set a "default connection" in SQL Developer?
    What I want to achieve: When I'm opening an SQL script with the SQL Developer it should already be chosen a defined connection, so that I only have to run the script.
    Normally after opening a script I have to choose manually a connection before running it. That's very annoying, if you have to run more than 100 scripts.
    Thanks in advance,
    Stefan

    A popular request. I suggest you vote on the various requests for this at the SQL Developer Exchange, to add weight for possible future implementation.
    Have fun,
    K.

  • Can SQL Dev compare difference of 2 sql scripts?

    I need to compare structure of table that has changed by someone but I don't know which table has been modified. I found that SQL Dev can export meta data into sql file and have version control either. I'm not sure can we compare this 2 sql scripts with version control to detect some change in table structure or not?
    Or if has any others solution, Please help.
    Regards,
    Sutthisak S.

    If you open the script in sqldev, you get a History tab next to the Worksheet. Selecting a revision will compare against that.
    To compare against another file, select File - Compare With - Other File.
    If the internal compare doesn't convince you, there are free alternatives out there, like WinMerge, or my personal favourite (but commercial) Beyond Compare.
    Have fun,
    K.

  • Password change fails in SQL Developer with verify function...

    A couple of months ago I enforced a password verify function on our 11.2.0.3 databases and also one legacy 10.2.0.4 database.
    At the time I tested on my account (which had elevated privileges...doh!).   Now some users are hitting expiry, they can't change it via SQL Developer.
    If I create a user with 'create session' privilege and set their profile to one that uses the verify function (see both below), I then log in to SQL Developer (we have tried with versions 3.1 (Windows) and 3.2 (Linux) with same failure results.
    BTW,.. the password verify function enforces the following:
    password must be minimum of 8 characters
    password must not be the same as the user name, or user name (1-100)
    password must contain at least a single digit
    password must contain at least a single character
    1. Works = I log into the local server and run command line SQLPlus, type 'password' and update.   I can successfully change my password.
    2. Fails = I log into the local server and run command line SQLPlus, type 'alter user <me> identified by <newpwd>;' I get:
    TEST: SUTEMP > alter user sutemp identified by carport9999;
    alter user sutemp identified by carport9999
    ERROR at line 1:
    ORA-28221: REPLACE not specified
    This error is because the account does not have the 'alter user' privilege.   I'm okay with this, as I don't want our users having this privilege.
    3. I start SQL Developer 3.2, type 'alter user <me> identified by <newpwd>;' I get the same ORA-28221 error as above.   That is fine, and as expected.
    4. Now in SQL Developer, I type 'password', set a valid password, but I get 'Failed to change password' in the Script Output tab.
    I have a database 'after servererror on database' trigger set, and querying the database table it is logging into, I see a record with a date stamp matching my failure with a server_error=28221 (the same as above).
    So I'm wondering if I'm doing something wrong here, or if this is a bug in SQL Developer.   I don't want standard users having 'alter user' privileges, but I do want to enforce password verification.
    I get the same result on three 11.2.0.3 databases (haven't tried any more but suspect same results for others) and one legacy 10.2.0.4 database, and using SQL Developer 3.1 and 3.2.
    DBA_PROFILE used:
    PROFILE   
    RESOURCE_NAME  
    RESOURCE LIMIT
    CTRU  
    COMPOSITE_LIMIT  
    KERNEL     DEFAULT
    CTRU  
    SESSIONS_PER_USER  
    KERNEL     10
    CTRU  
    CPU_PER_SESSION  
    KERNEL     DEFAULT
    CTRU  
    CPU_PER_CALL  
    KERNEL     DEFAULT
    CTRU  
    LOGICAL_READS_PER_SESSION    KERNEL     DEFAULT
    CTRU  
    LOGICAL_READS_PER_CALL  
    KERNEL     DEFAULT
    CTRU  
    IDLE_TIME  
    KERNEL     DEFAULT
    CTRU  
    CONNECT_TIME  
    KERNEL     DEFAULT
    CTRU  
    PRIVATE_SGA  
    KERNEL     DEFAULT
    CTRU  
    FAILED_LOGIN_ATTEMPTS  
    PASSWORD 10
    CTRU  
    PASSWORD_LIFE_TIME  
    PASSWORD 180
    CTRU  
    PASSWORD_REUSE_TIME  
    PASSWORD DEFAULT
    CTRU  
    PASSWORD_REUSE_MAX  
    PASSWORD 5
    CTRU  
    PASSWORD_VERIFY_FUNCTION     PASSWORD VERIFY_FUNCTION_11G
    CTRU  
    PASSWORD_LOCK_TIME  
    PASSWORD .002
    CTRU  
    PASSWORD_GRACE_TIME  
    PASSWORD 21
    16 rows selected.
    Verify Function used:
    $ cat utlpwdmg.sql
    Rem
    Rem $Header: utlpwdmg.sql 02-aug-2006.08:18:05 asurpur Exp $
    Rem
    Rem utlpwdmg.sql
    Rem
    Rem Copyright (c) 2006, Oracle. All rights reserved.
    Rem
    Rem    NAME
    Rem      utlpwdmg.sql - script for Default Password Resource Limits
    Rem
    Rem    DESCRIPTION
    Rem      This is a script for enabling the password management features
    Rem      by setting the default password resource limits.
    Rem
    Rem    NOTES
    Rem      This file contains a function for minimum checking of password
    Rem      complexity. This is more of a sample function that the customer
    Rem      can use to develop the function for actual complexity checks that the
    Rem      customer wants to make on the new password.
    Rem
    Rem    MODIFIED   (MM/DD/YY)
    Rem    suren       05/09/13 - customise for NIHI use
    Rem    asurpur     05/30/06 - fix - 5246666 beef up password complexity check
    Rem    nireland    08/31/00 - Improve check for username=password. #1390553
    Rem    nireland    06/28/00 - Fix null old password test. #1341892
    Rem    asurpur     04/17/97 - Fix for bug479763
    Rem    asurpur     12/12/96 - Changing the name of password_verify_function
    Rem    asurpur     05/30/96 - New script for default password management
    Rem    asurpur     05/30/96 - Created
    Rem
    -- This script sets the default password resource parameters
    -- This script needs to be run to enable the password features.
    -- However the default resource parameters can be changed based
    -- on the need.
    -- A default password complexity function is also provided.
    -- This function makes the minimum complexity checks like
    -- the minimum length of the password, password not same as the
    -- username, etc. The user may enhance this function according to
    -- the need.
    -- This function must be created in SYS schema.
    -- connect sys/<password> as sysdba before running the script
    CREATE OR REPLACE FUNCTION verify_function_11G
    (username varchar2,
      password varchar2,
      old_password varchar2)
      RETURN boolean IS
       n boolean;
       m integer;
       differ integer;
       isdigit boolean;
       ischar  boolean;
       ispunct boolean;
       db_name varchar2(40);
       digitarray varchar2(20);
       punctarray varchar2(25);
       chararray varchar2(52);
       i_char varchar2(10);
       simple_password varchar2(10);
       reverse_user varchar2(32);
    BEGIN
       digitarray:= '0123456789';
       chararray:= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
       -- Check for the minimum length of the password
       IF length(password) < 8 THEN
          raise_application_error(-20001, 'Password length less than 8');
       END IF;
       -- Check if the password is same as the username or username(1-100)
       IF NLS_LOWER(password) = NLS_LOWER(username) THEN
         raise_application_error(-20002, 'Password same as or similar to user');
       END IF;
       FOR i IN 1..100 LOOP
          i_char := to_char(i);
          if NLS_LOWER(username)|| i_char = NLS_LOWER(password) THEN
            raise_application_error(-20005, 'Password same as or similar to user name ');
          END IF;
        END LOOP;
       -- Check if the password contains at least one letter, one digit
       -- 1. Check for the digit
       isdigit:=FALSE;
       m := length(password);
       FOR i IN 1..10 LOOP
          FOR j IN 1..m LOOP
             IF substr(password,j,1) = substr(digitarray,i,1) THEN
                isdigit:=TRUE;
                 GOTO findchar;
             END IF;
          END LOOP;
       END LOOP;
       IF isdigit = FALSE THEN
          raise_application_error(-20008, 'Password must contain at least one digit, one character');
       END IF;
       -- 2. Check for the character
       <<findchar>>
       ischar:=FALSE;
       FOR i IN 1..length(chararray) LOOP
          FOR j IN 1..m LOOP
             IF substr(password,j,1) = substr(chararray,i,1) THEN
                ischar:=TRUE;
                 GOTO endsearch;
             END IF;
          END LOOP;
       END LOOP;
       IF ischar = FALSE THEN
          raise_application_error(-20009, 'Password must contain at least one digit, and one character');
       END IF;
       <<endsearch>>
       -- Check if the password differs from the previous password by at least
       -- 3 letters
       IF old_password IS NOT NULL THEN
         differ := length(old_password) - length(password);
         differ := abs(differ);
         IF differ < 3 THEN
           IF length(password) < length(old_password) THEN
             m := length(password);
           ELSE
             m := length(old_password);
           END IF;
           FOR i IN 1..m LOOP
             IF substr(password,i,1) != substr(old_password,i,1) THEN
               differ := differ + 1;
             END IF;
           END LOOP;
           IF differ < 3 THEN
             raise_application_error(-20011, 'Password should differ from the old password by at least 3 characters');
           END IF;
         END IF;
       END IF;
       -- Everything is fine; return TRUE ;
       RETURN(TRUE);
    END;
    alter profile ctru limit password_verify_function verify_function_11g;
    alter profile default limit password_verify_function verify_function_11g;
    alter profile web_and_it limit password_verify_function verify_function_11g;

    okay,... I just saw another website which shows I should put in the 'replace <oldpwd>' clause in.
    This works in SQL Developer:     alter user sutemp identified by carport999 replace garage999;
    So why does the 'password' command fail?     (Developers:  it would also be helpful to have the ORA- error displayed as opposed to 'Failed to change password')

Maybe you are looking for

  • Smart Form Download in PDF

    Hello All ,                I have created one smart form and provided option to download the same in PDF. My Problem is that is  downloaded in PDF but at the same time my end user want to see the print preview and take the print from there itself als

  • Single row subquery Returning more than one row

    Hi, This is urgent............. could u any one please suggest me on this query it returning single row subquey returnin more than one row In this 2nd suquery fails some of the order_numbers returning more than price_list based on dates and in that s

  • Get Node Key Multiple Items Selected  from ALV tree

    Hello Experts, I'm having a problem in getting Node keys for the items displayed as ALV tree. I'm able to get Node key, when only ONE record (Item) is selected. But, when I select multiple items under a Single node am not able to read(get) the node k

  • ORA-01882: timezone region not found  in NetBeans 7.0.1

    Please how do I solve ORA-01882: timezone region not found in Netbeans 7.0.1 ?

  • Photoshop elements 10 (error 6)??

    I bought a computer some months ago it had photoshop elements 10 included. It worked fine ntil today when I tried opening it and an error appeared. My operative system is windows. What can I do to fix it . Please help!!