Error in Procedure to Create Users. Duplicate name.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brig
    New Member
    • Jul 2007
    • 8

    Error in Procedure to Create Users. Duplicate name.

    Hi All,

    I have a Table (STDTable) with 3 columns: STDAccount, STDpassword, IRowId.
    I am getting a user conflicts error when I 'get the next' user info from the table. I am using SQLDeveloper.

    Below is the procedure and the error that follows. I understand I should not be creating users in the sys schema, but I am still learning and don't know how to make a new schema to put these users into. So for now, this is what I am doing. I changed this procedure from one I had, this time using a cursor.
    THANK YOU for any help or guidance.
    brig


    CREATE OR REPLACE PROCEDURE MakeNewStudents
    IS

    --Declare, don't select rows yet

    CURSOR stdCurSor IS
    SELECT iRowId,
    stdAccount,
    stdPassword
    FROM sys.stdTable;
    iLoopCount INT := 1;
    InexTrowId INT := 1;
    iCurrentRowId INT := 0;
    iRowCount INT := 0;
    iRowNo INT := 0;
    vchaccounName VARCHAR2(7) := '';
    vchPasswordnmbr VARCHAR2(9) := '';

    BEGIN
    OPEN stdCurSor;

    LOOP
    FETCH stdCurSor INTO iRowNo,
    vchaccounName,
    vchPasswordnmbr ;

    dbms_Output.Put _Line('Is ther an Name ? '
    ||vchaccounName );--testing

    EXIT WHEN stdCurSor%NOTFO UND;

    IF iRowNo = InexTrowId THEN
    InexTrowId := InexTrowId + 1;

    EXECUTE IMMEDIATE 'CREATE USER vchACCOUNName
    IDENTIFIED BY vchPasswordNmbr
    DEFAULT TABLESPACE STUDENTTABLESPA CE
    QUOTA 10M ON example
    QUOTA 10M ON system';
    END IF;

    iRowCount := stdCurSor%ROWCO UNT;

    dbms_Output.Put _Line('Number of Rows '
    ||iRowCount); --testing

    END LOOP;--in FOR

    CLOSE stdCurSor;
    END;--procedure

    Connecting to the database Brig.
    ORA-01920: user name 'VCHACCOUNNAME' conflicts with another user or role name
    ORA-06512: at "SYS.MAKENEWSTU DENTS", line 26
    ORA-06512: at line 2
    Is ther an Name ? ada6464
    Number of Rows1
    Is ther an Name ? hol3743
    Process exited.
    Disconnecting from the database Brig.
  • brig
    New Member
    • Jul 2007
    • 8

    #2
    NEVER MIND :-)

    I got it all to work. Thank you.

    Comment

    Working...