Help needed in auto-increment in Oracle SQLPlus
hi everybody
I have a table in which the id column should be autoincrementing. Whenever i insert a row in the table, the id should be autoincremented. How to create the table in Oracle SQL Plus. I insert the row using JDBC connection. So how to insert the value for id in java program.
Thanks in advance
How to use Oracle SQLPlus has absolutely nothing to do with Java or JDBC; you should ask this question in a different forum, such as one of the Oracle database forums, here:
http://forums.oracle.com/forums/category.jspa?categoryID=18
Similar Messages
-
Help needed to take control back from sqlplus for expired password
Hi,
I am executing the following line for Oracle 11g in Windows from my application
sqlplus -L "aaaa"/"aaaa" @connectonly.sql >>"D:\tempDBlogs\connectonly.log"
connectonly.sql file contains the following code:
whenever sqlerror exit 1
whenever oserror exit 2
exit
This piece of code executes fine for both correct & incorrect userid & password and gives proper messages. Now the problem is when password of the user in DB gets expired. The controls waits for user input. But my problem is I am runinng this code from an application which waits for sqlplus.exe to end, as it can't proceed without validation. But sqlplus runs as background process and the command prompt never comes to user. Moreover I dont want to give the user the option to change DB password from my application front end.
So I need to find a way so that if password is expired sqlplus will return the control and will not wait for user input. Or atleast my application gets to know that the password is expired so that it can kill sqlplus process.
Can somebody help me in this.interesting question. I tried something on unix and this seems to work. I simply piped a line through this which leads to an error with the expire-prompt and doesnt do any harm when there is no such prompt:
oracle@oracle:~$ echo "" | sqlplus brost/secret @test.sql
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 19 10:18:36 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-28001: the password has expired
Changing password for brost
New password:
Retype new password:
ERROR:
ORA-00988: missing or invalid password(s)
Password unchangedSomething similar should be possible on windows. Of course, the real solution would be flag for sqlplus that makes it absolutely non-interactive. -
Help needed, double post-submit on Oracle 9iAS ?
Hi,
I am working on a project where we make use of Oracle Application Server 9.0.3 in combination with OC4J and struts. During development we have made use of JDeveloper 9.0.3 and its integrated server for testing the application. Unfortunately we have been waiting too long with deploying the app on the 'real' (Oracle IAS) server, and now we found out that when deploying the application on IAS, some parts of our application do not seem to work anymore.
After a little investigation we found out that all POST submits of our forms seem to be submitted twice.
Since we did some Javascript-evaluation before submitting, we first thought that that the problem was client-side, but after adding code to make sure that the submit will only occur once (flag set to 1 before submit, and only submit when flag = 0 etc..), the problem still persists...so the submit does not come from our document.formx.submit() command...
Let me restate that this double posting does not occur within the JDeveloper-test-environment using the same browser.
Now convinced that the problem was server-side, we thought we could focus on this side. Unfortunately, after an occasional test with a Mozilla-browser (our default (customer) browser is IE6), the problem did NOT occur !
So, to sum things up :
- Javascript does not submit twice
- On the server, the logging indicates a double post-action
- On client-side, only a single-post is allowed...
- mozilla does not seem to cause problems, while IE6 does.
- JDeveloper runtime environment does not expose the problem (with either browser, it goes smooth), while deploying on the IAS 9.0.3 server does...
Can anyone shed some light on this ? We've been looking into it for a day already, and need to get it fixed asap (as always ;o))...
Thanks for any info,
Bas van DrielThis sounds like a strange java problem not IAS
From the sun site
"When I try to open a file through my Java Web Start application, a message box pops up with the title "javaw.exe - No Disk". Why does this happen?
This is a bug in the Java 2 SDK v1.2.2 or v1.3 . This bug will be fixed in a future Java 2 SDK release. In the meantime, there are a couple workarounds: "
Id be very tempted to remove any JDK/JRE installations, or even better start with a clean machine.
Hope this helps. -
Help needed...new to Oracle
Hi friends,
I am totally new to oracle i am a .net and sql developer. I have no idea of doing this. I need ur help badly in this. I hope you will help me and very much thankful to you in advance. Send me the code snippet of doing this.
Oracle forms 6i
Sql>desc or_record
Name null? Type
Or_seq not null number
Mrn varchar2(10)
Patient_name varchar2(40)
Age number
Room_no varchar2(10)
Surgeon number
Asst_surgeon number
Surgeon2 number
Anesthesiologist number
Asst_anesthesiologist number
Anes_tech number
Or_date date
Incision_time1 varchar2(5)
Skin_clos_time varchar2(5)
Scrub_nurse1 number
Scrub_nurse2 number
Circ_nurse1 number
Reliever1 number
Reliever2 number
Relievercn number
Preoperative_diag varchar2(100)
Postoperative_diag varchar2(100)
Operation varchar2(100)
Patient_arrival_time varchar2(5)
Time_in varchar2(5)
Induction_time varchar2(5)
Incision_time varchar2(5)
Surgery_end varchar2(5)
Waking_time varchar2(5)
Tm_back_to_room varchar2(5)
Use_image_intensifier char(1)
X_ray_tech number
Laboratory_spec varchar2(100)
Histo_path varchar2(100)
Culture varchar2(100)
Scrub_nur number
Circ_nur number
Sql> desc or_record_det
Name null? Type
Or_seq_det number
Sponges varchar2(50)
Ft_table number
Ft_floor number
St_table number
St_floor number
Third_table number
Third_floor number
These are the 2 tables which has to be in the same form. The upper one is master block and the lower one is details block in the form. The second one must be in the tabular format. The first one in the form format. We have to make the relationship. That’s it all are text fields only. We need to retreive,update,insert,delete.generate sequence number for or_seq and it should be updated to or_seq_det which is the attribute of second table.Maybe you should ask this in the Forms forum.
-
Help needed in Unix script for oracle 9i
Hi gurus,
I'm working on oracle 9i in solaris, i would like to calculate the amount of archived logs generate per day. Can anyone please help me to find that.
ThanksPut the following lines in a script and it should work for you.
SET feedback off
SET line 200
COL NAME FOR a100
-- counts the no of archives generated today
select count(*) "No. of Logs for today" from v$archived_log where to_char(completion_time,'DD-MON-YY')=to_char(sysdate,'DD-MON-YY');
-- lists all archive generated for the day
select name,blocks*block_size as "Size in KB" from v$archived_log
where to_char(completion_time,'DD-MON-YY')=to_char(sysdate,'DD-MON-YY');
-- shows total size in KB
select sum(blocks*block_size) "Total Log Size for day in KB" from v$archived_log
where to_char(completion_time,'DD-MON-YY')=to_char(sysdate,'DD-MON-YY');
Hope this helps.
Thanks
Siba -
BSP -> HAP_DOCUMENT.
I browsed through some threads and found out the code for this, but wanted to know which page/controller method I should write in my code. This functionality is required in both Manager page and in Employee page.. Could someone help me on this, it would be very helpful...hi ,
the probelm with adobe (pdf) only(.i.e. pdf attachments are damaged or something) so, check the below links to get more info regrding above error...
http://www.computing.net/answers/windows-xp/pdf-error-acrobat-could-not-open/118542.html
http://forum.planetpdf.com/wb/default.asp?action=9&fid=6&read=62004
http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=6911
thnx
suriya -
How to use auto incremented tabe to create a CMP Entity Bean
hi,
I want create a CMP entitybean with an auto incremented table in
Oracel. So I need to know
- how to create a table with an auto-incremented field in oracel and
- how to change the create() method according to that.
I am using Sun studio enterprise for EJB developing.
kaushalyaFor auto increment in Oracle you should use Sequence/Trigger combination.
And useful thread from EJB forum:
http://forum.java.sun.com/thread.jspa?forumID=13&threadID=478783 -
Auto-Increment a String of data
OK, I see to be going round and round with the same problem.
I have UDF that contains 12 digits but the first 6 digits will always be the same.
The next 5 digits are the set of digits I need to auto increment
The last digit is a check digit that is pre-determined.
So I need assistance on a formatted search that looks at just the 5 digits and auto-increments those.
What seems to be the problems is once the UPC gets 12 digits, it only seems to start auto updating the 12 check digit and I do not want the 12th digit even touched.
I started out with 84573410001
After I made a update to that number the final value of the UDF is 845734100011
When a user used the formatted search the next value it should update is 84573410002
This is the query I got from teh forum a few days ago and it works as long as there is only 11 digits in the UDF, once I add teh 12th digit then it starts to auto increment the 12th digit.
Thanks,
CraigThat was the posting I did the first time around and the Query of:
SELECT str(CAST(MAX(T.U_UPC) as numeric)+1,12)
FROM RDR1 T
Works great when there is only 11 digits to increment but I want to only auto-increment a string of 5 digits with in the value.
First String (Will always be the same) 845734
Second String (THIS IS THE SET OF DIGITS I WANT TO AUTO_INCREMENT) Starts at 10001 and goes up.
Third string - 1 digit that is updated based on a set of values I built into a User Defined table and adds to the first 2 strings based on a comparison. -
Insert to 2 Tables and Auto-Increment
I applied the Insert To 2 Tables Wizard and then added an Auto-Increment
behavior to auto increment a field in the master table. BUT - I also
need to auto-increment a field in the detail table. The AutoIncrement
behavior only offers fields for the master table. So - how do I
auto-increment the detail table?
I know I could create a custom trigger - but how do you grab the primary
key from the DETAIL table?
Alec Fehl, MCSE, A+, ACE, ACI
Adobe Community Expert
AUTHOR:
Microsoft Office 2007 PowerPoint: Comprehensive Course (Labyrinth
Publications)
Welcome to Web Design and HTML (Labyrinth Publications)
CO-AUTHOR:
Microsoft Office 2007: Essentials (Labyrinth Publications)
Computer Concepts and Vista (Labyrinth Publications)
Mike Meyers' A+ Guide to Managing and Troubleshooting PCs (McGraw-Hill)
Internet Systems and Applications (EMC Paradigm)Got it. Advanced tab of the AutoIncrement server behavior - remove the
master table and add the detail table. Then return to basic tab and add
the appropriate field.
Alec Fehl, MCSE, A+, ACE, ACI
Adobe Community Expert
AUTHOR:
Microsoft Office 2007 PowerPoint: Comprehensive Course (Labyrinth
Publications)
Welcome to Web Design and HTML (Labyrinth Publications)
CO-AUTHOR:
Microsoft Office 2007: Essentials (Labyrinth Publications)
Computer Concepts and Vista (Labyrinth Publications)
Mike Meyers' A+ Guide to Managing and Troubleshooting PCs (McGraw-Hill)
Internet Systems and Applications (EMC Paradigm) -
Is there a auto-increment data type in Oracle
Is there a auto-increment data type in Oracle ?
How to do it if there is no auto-increment data type in Oracle ?
nulljackie (guest) wrote:
: Is there a auto-increment data type in Oracle ?
: How to do it if there is no auto-increment data type in Oracle
Hi,
I think you need unique ID's, for this purpose you use sequences
in Oracle. Example:
create table xy (
id number,
name varchar2(100)
alter table xy
add constraint xy_pk primary key(id);
create sequence xy_seq start with 1 maxvalue 99999999999;
(there are many other options for create sequence)
create or replace trigger xy_ins_trg
before insert on xy
for each row
begin
select xy_seq.nextval
into :new.id
from dual;
end;
This produces a unique value for the column id at each insert.
Hope this will help.
peter
null -
Auto-increment identity column through procedure in oracle 10g on windows
Hi,
I need identity primary key which should be auto increment before while inserting data into table.
for this i had use sequence and then trigger to increment it.
but now i need to increment it in Procedure, while my procedure is having code to insert data in same table which has primary keyHi,
SNEHA RK wrote:
Hi,
I need identity primary key which should be auto increment before while inserting data into table.
for this i had use sequence and then trigger to increment it.Right. Some database products have auto-increment columns, and they are really handy. Unfortunately, Oracle does not have auto-increment columns. A sequence is an auto-increment object, and it's the right way to automatically generate unique identifiers, but you need to explicity reference the sequence, either in you DML statements, or in a trigger that will automatically fire before a DML statement.
but now i need to increment it in Procedure, while my procedure is having code to insert data in same table which has primary keyAre you saying that you need to increment the sequence, completely aside from INSERTing into the table?
If so, just reference sequence_name.NEXTVAL wherever you want to. In PL/SQL, you can say
SELECT sequence_name.NEXTVAL
INTO number_variable
FROM dual;This works in any version of Oracle, but starting in Oracle 11, you also have the option of referencing te sequence without using dual, or any other table.
I hope this answers your question.
If not, post a complete script that people can run to re-create the problem and test their ideas.
For example:
-- Here are the table and the seqauence that I created:
CREATE TABLE table_x ...
CREATE SEQUENCE ...
-- Here is the BEFORE INSERT trigger I wrote:
CREATE OR REPLACE TRIGGER ...
-- The trigger works exactly how I want it to in statements like this:
INSERT INTO table_x ...
-- So there are no problems (that I know of) with anything up to this point.
-- Now I want to use the same sequence to ...
-- so that when I execute a statement like this
-- then the next time I add a new row to the orginal table, like this
INSERT INTO table_x ...
-- then the contents of table_x should be ... because ... -
Help needed on installation of Oracle 9i on Sun Solaris 8
Hey,
Help needed on installation of Oracle 9i EE on Sun Solaris 8. The problem I met was: we followed the installation guide from the documentation. And we selected the choice "install software only". After it was done successfully, we run Database Configuration Assistant utility to create a database instance. But finally it always tried to create the instance at the root directory ( / ) which doesn't have enough space and then failed. The case was that we have set the enviroment parameters: $ORACLE_BASE = /export/mydata, $ORACLE_HOME = /export/apps/oracle9i. That means it should be installed at /export/mydata, but it didn't. Any help or advice are welcome. Thanks.
SimonI have downloaded Oracle 11G R2 version from Windows and extracted it in Windows and copied it into DVD after extraction in two folders. Now I am mounting that DVD in Solaris 10 installed in my VMware . I made a new directory named as 'installation ' under /export/home/oracle and copied the folders from DVD to 'installation' folder. Now I am entering installation folder and try to do ./runInstaller as 'oracle ' user and getting the error mentioned before.
Edited by: 916438 on Mar 31, 2012 5:55 PM -
Help needed on installation of Oracle 9i EE on Sun Solaris 8
Hey,
Help needed on installation of Oracle 9i EE on Sun Solaris 8. The problem I met was: we followed the installation guide from the documentation. And we selected the choice "install software only". After it was done successfully, we run Database Configuration Assistant utility to create a database instance. But finally it always tried to create the instance at the root directory ( / ) which doesn't have enough space and then failed. The case was that we have set the enviroment parameters: $ORACLE_BASE = /export/mydata, $ORACLE_HOME = /export/apps/oracle9i. That means it should be installed at /export/mydata, but it didn't. Any help or advice are welcome. Thanks.
SimonI have downloaded Oracle 11G R2 version from Windows and extracted it in Windows and copied it into DVD after extraction in two folders. Now I am mounting that DVD in Solaris 10 installed in my VMware . I made a new directory named as 'installation ' under /export/home/oracle and copied the folders from DVD to 'installation' folder. Now I am entering installation folder and try to do ./runInstaller as 'oracle ' user and getting the error mentioned before.
Edited by: 916438 on Mar 31, 2012 5:55 PM -
Help needed to loadjava apache poi jars into oracle database.
Help needed to loadjava apache poi jars into oracle database. Many classes left unresolved. (Poi 3.7, database 11.1.0.7). Please share your experience!
Hi,
The first 3 steps are just perfect.
But with
loadjava.bat -user=user/pw@connstr -force -resolve geronimo-stax-api_1.0_spec-1.0.jar
the results are rather unexpected. Here is a part of the log file:
arguments: '-user' 'ccc/***@bisera7-db.dev.srv' '-fileout' 'c:\temp\load4.log' '-force' '-resolve' '-jarsasdbobjects' '-v' 'geronimo-stax-api_1.0_spec-1.0.jar'
The following operations failed
resource META-INF/MANIFEST.MF: creation (createFailed)
class javax/xml/stream/EventFilter: resolution
class javax/xml/stream/events/Attribute: resolution
class javax/xml/stream/events/Characters: resolution
class javax/xml/stream/events/Comment: resolution
class javax/xml/stream/events/DTD: resolution
class javax/xml/stream/events/EndDocument: resolution
class javax/xml/stream/events/EndElement: resolution
class javax/xml/stream/events/EntityDeclaration: resolution
class javax/xml/stream/events/EntityReference: resolution
class javax/xml/stream/events/Namespace: resolution
class javax/xml/stream/events/NotationDeclaration: resolution
class javax/xml/stream/events/ProcessingInstruction: resolution
class javax/xml/stream/events/StartDocument: resolution
class javax/xml/stream/events/StartElement: resolution
class javax/xml/stream/events/XMLEvent: resolution
class javax/xml/stream/StreamFilter: resolution
class javax/xml/stream/util/EventReaderDelegate: resolution
class javax/xml/stream/util/StreamReaderDelegate: resolution
class javax/xml/stream/util/XMLEventAllocator: resolution
class javax/xml/stream/util/XMLEventConsumer: resolution
class javax/xml/stream/XMLEventFactory: resolution
class javax/xml/stream/XMLEventReader: resolution
class javax/xml/stream/XMLEventWriter: resolution
class javax/xml/stream/XMLInputFactory: resolution
class javax/xml/stream/XMLOutputFactory: resolution
class javax/xml/stream/XMLStreamReader: resolution
resource META-INF/LICENSE.txt: creation (createFailed)
resource META-INF/NOTICE.txt: creation (createFailed)
It seems to me that the root of the problem is the error:
ORA-29521: referenced name javax/xml/namespace/QName could not be found
This class exists in the SYS schema though and is valid. If SYS should be included as a resolver? How to solve this problem? -
Urgent help needed on oracle queueing
Hi
we have created AQ tables and queues but are facing with the following errors
Thu Aug 30 17:25:31 2007
Errors in file e:\orant\ora9i\pds\udump\pds_ora_4092.trc:
ORA-00600: internal error code, arguments: [opidor: call 1], [], [], [], [], [], [], []
Thu Aug 30 17:44:17 2007
Errors in file e:\orant\ora9i\pds\udump\pds_ora_4092.trc:
ORA-00600: internal error code, arguments: [17281], [1001], [0x25EBB628], [], [], [], [], []
ORA-01001: invalid cursor
Thu Aug 30 17:44:17 2007
Errors in file e:\orant\ora9i\pds\udump\pds_ora_4092.trc:
ORA-00600: internal error code, arguments: [17281], [1001], [0x25EBB628], [], [], [], [], []
ORA-01001: invalid cursor
ORA-00600: internal error code, arguments: [17281], [1001], [0x25EBB628], [], [], [], [], []
ORA-01001: invalid cursor
help needed asap
thanxORA-600 should be reported to Oracle support with trace files and alertlog.
Well the following note may help you:
Note: 433389.1
Hope this Helps
Regards
Maybe you are looking for
-
Error while saving the PO, "Update terminated".
Hi All, A framework PO is created on 23 Nov 09. The valdity period is from 23 Nov 09 to 22 Nov 10.It was never released or processed. The delivery dates for all item is 22 Nov 10. When we make any changes in that PO and save it we get the message, "M
-
How do I get the Up to date OSX?
Hi, so I've tried to get the free download of the OSX Lion, as I bought my MacBook in June, but it never goes through. I've tried to redo it but now it says that I cant because I already registered my MacBook to get the update. Help, please?
-
Submitting only part of a Flash form's data - possible?
So, in this app that I'm building, it would be REALLY handy to be able to process select portions of the Flash form. It's essentially an app with a couple of smaller sub-apps contained within; think of something like a CRM app. Is it possible to only
-
Reference field value disappears on the Receivables transaction line window
Hi Everybody, I have below problem while creating the manual invoice from Receivables. when i am trying to utilize the reference field on the Receivables transaction line, so that it can be used to enter extra data for manual invoices. At the moment
-
Enhansement in MIRO Transaction
Dear xperts. i m new to ABAP , I need to modify the header text field in DETAILS Tab of MIRO transaction.can any one please help me how can i found the User EXIT and how can i Edit the code to for Header test field. i need to input the code LAND1 is