Home » Developer & Programmer » Forms » Server and Stations Problem (Oracle database 10g. Developer 6i)
Server and Stations Problem [message #641939] Thu, 27 August 2015 14:39 Go to next message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
Hello guys,
Guys, I am making a test program to test the network and how to connect clients to the server.
Currently, I have Oracle database 10g in a server.
I created a table TestA ( Id_no, Name).
Then, I created a form for that table. the Id_No is supposed to be an auto_generated_number. In my form I have the following buttons :
Add , Save.
In Station 1, if he clicks on add the id_no is generated as the followings :
declare
check_max number ;
begin
select MAX(ID_NO) into check_max from test A ;
:TestA.ID_NO := max_no + 1 ;
commit_form ; -- I used this line to make sure that whenever the user clicks on add the number is saved so if the person in station 2 click add it gives him the next max number.

in the save button I used the following code :
commit_form ;

I don't have problem generating the serial number which is auto_increment.
I have having problem when 2 or more stations are working in the same time.
If Station 1 finished completing the value of the other column and he clicked on Save.
The program freezes. The person in Station 2 should stop working in what he was doing and he should commit his work so the other person can add a new record.
In addition,
the table ower's is A. In both stations, they use the username A.

I hope you could understand my problem. if you need more information. I can fill you with it.
Re: Server and Stations Problem [message #641948 is a reply to message #641939] Fri, 28 August 2015 00:14 Go to previous messageGo to next message
Littlefoot
Messages: 21684
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Auto-generated-numbers shouldn't be generated that way. "MAX + 1" is OK in a single-user environment, but - in a multi-user environment, it causes problems (the one you've just hit).

Use a sequence instead. It doesn't guarantee gapeless numbers, but all of them will be unique.

In the database (connected to that schema) create it as
create sequence seq_auto_number;

Then, in a form, use it as
select seq_auto_number.nextval
  into :testa.id_no
  from dual;

You don't have to commit anything at this stage.
Re: Server and Stations Problem [message #642014 is a reply to message #641948] Sun, 30 August 2015 00:53 Go to previous messageGo to next message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
I have done the following code in a pre-insert trigger in the block level :
 DECLARE 
	X NUMBER ; 
BEGIN 
	SELECT SERIAL_NO_ID_NO.NEXTVAL INTO X FROM DUAL ; 
	:registration_table.id_no := X ; 
END ;  


I am having this error :
ORA-00600: internal error code, arguments:[17069],[65742296],[][][][][]
Re: Server and Stations Problem [message #642015 is a reply to message #642014] Sun, 30 August 2015 01:47 Go to previous messageGo to next message
Michel Cadot
Messages: 67923
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

ORA-00600/ORA-07445/ORA-03113 = Oracle bug => search on Metalink/MOS and/or call Oracle support
Have a look at alert.log and trace files.
You can also read this article: Troubleshooting Internal Errors.

Re: Server and Stations Problem [message #642016 is a reply to message #642015] Sun, 30 August 2015 04:55 Go to previous messageGo to next message
Littlefoot
Messages: 21684
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Create a stored function which will return the next sequence number:
create function f_serial_no return number is
  retval number;
begin
  select serial_no_id_no.nextval 
    into retval
    from dual;

  return (retval);
end;


Use it in PRE-INSERT TRIGGER as
:registration_table.id_no := f_serial_no;


Any improvement?
Re: Server and Stations Problem [message #664490 is a reply to message #642016] Thu, 20 July 2017 01:53 Go to previous message
amjad_alahdal
Messages: 102
Registered: October 2013
Location: Saudi Arabia
Senior Member
Thank You. Problem Solved.
Previous Topic: Problem with adding and updating
Next Topic: create a module from a specific select statement
Goto Forum:
  


Current Time: Fri Jul 30 00:22:38 CDT 2021