473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error in Procedure to Create Users. Duplicate name.

8
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%NOTFOUND;

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

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

iRowCount := stdCurSor%ROWCOUNT;

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.MAKENEWSTUDENTS", 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.
Aug 3 '07 #1
1 1787
brig
8
NEVER MIND :-)

I got it all to work. Thank you.
Aug 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
6
by: Patrick | last post by:
Hello I have many different tables, that most have the same structure.. they all have some primary key, some fields and mylinkid ... so what I want to make is to create a stored procedure, where...
3
by: WindAndWaves | last post by:
I am writing error handling procedures at the moment. Here are some questions: 1. Can you write a procedure that picks up any error and deals with it no matter where it happens in the database?...
0
by: Janning Vygen | last post by:
Hi, i have a question about how to handle postgresql constraint errors in the client app. I found some mails in the archive about it, too. But i have still so many questions about how to do it,...
5
by: Jurgen Defurne | last post by:
I am currently designing an application which should be accessible from different interfaces. For this I like to be using stored procedures to process the contents of form submissions and dialog...
1
by: asf93555 | last post by:
Running under SQL2000 I can not get an INSTEAD trigger to function. I've even copied the example directl from books online - no joy . . . Server: Msg 170, Level 15, State 1, Procedure...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
8
by: zyzolus | last post by:
Hello, I create 2 unique indexes on 2 fields: Field1 and Field2. What is the way generate custom error message independent of each field?ex.: "Duplicate value in Field1" or "Duplicate value...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.