PL/SQL :: Oracle 12c - Generated By Default As Identity Generates Duplicates?
Jul 24, 2013
I am trying the new Oracle 12c and its feature to create columns with the keyword IDENTITY. I create a table CREATE TABLE xt (a NUMBER GENERATED by default AS IDENTITY PRIMARY KEY, b VARCHAR2(10));
And populate it, sometimes specifying the value for a and sometimes relying on the system to generate the value:
INSERT INTO xt (b) values ('a');INSERT INTO xt (b, a) values ('b', default);INSERT INTO xt (b, a) values ('c', 3);INSERT INTO xt (b) values ('d');INSERT INTO xt (b) values ('e');
The problem is that the fourth INSERT fails because the system tries to use the value 3 which is already taken. The fifth statement gets the value 4.
And the table now contains: A B - -1 a 2 b 3 c 4 e Is there something I am missing? I understood that by specifying BY DEFAULT, I would be allowed to sometimes specify values on my own without them interfering with the generated values. I now that the same thing works correctly in MySQL (where I would get five rows from 1 to 5 with the same INSERT statements) /nikos
View 11 Replies
ADVERTISEMENT
Apr 15, 2010
i have a project that needs to have a identity number in the table.this is the table:
create global temporary table BOOK_INFO
( row_id number(5),
BOOK_TITLE char(20),
BOOK_AUTHOR char(15)
) on commit preserve rows;
i dont know how can i generate row_id, in sybase i can only set the datatype of row_id in IDENTITY and it will automatically generates number and as the transaction ended the row_id will automatically back to 1.
in oracle i tried to create sequence but it didnt back to 1 when the transaction/procedure ended.. Like for example if the procedure ended and the last row_id inserted in the table is 300 the next run of the procedure will start in 301. but i need to start in 1 in every run of the procedure.
Also, i tried to set the variable v_row_id to 0 and it increment by 1 as it insert in the table, but the problem is there are times that in 1 book_title there is more than 1 author. so the v_row_id of the book_title with more than 1 author is all the same.Here is my query:
insert into BOOK_INFO
(select v_row_id, BOOK_TITLE, BOOK_AUTHOR from LIBRARY);
The result is:
ROW_ID BOOK_TITLE BOOK_AUTHOR
1 BOOK_1 AUTHOR_1
1 BOOK_1 AUTHOR_2
1 BOOK_1 AUTHOR_3
1 BOOK_1 AUTHOR_4
2 BOOK_2 AUTHOR_5
View 8 Replies
View Related
Dec 5, 2012
My company has a "generic information management platform" based on Oracle,
including:
Oracle Identity Manager 10g
Lotus
Oracle Internat Directory 10g
Oracle Portal 10g
Oracle E-Business Employee
Oracle E-Business User Management
Microsoft Active Directory
Mail System
Oracle Database
All above these systems constitute the generic information management platform.
---------------------------------------------------------------------------------------
There are 60,000 user records in the Oracle Database, lots of user records are duplicate, invalid and redundant. We want delete them by Oracle Identity Manager. But Oracle Identity Manager has no bulk deletion of users function!!!
So, we want customized development this generic information management platform, specifically customized development Oracle Identity Manager 10g's administrator interface.
We want add a JSP page, use this JSP page to bulk delete users. (user number > 60,000)
----------------------------------------------------------------------------------------
What's should we do? We can't directly manipulate the database to delete the users, all users are associated by API and exist in many systems.
----------------------------------------------------------------------------------------
View 1 Replies
View Related
Nov 11, 2011
I set 'maxopenfiles 4' when allocating channel to sbt in my products env, I got 2 backup pieces in one backup set because that tablespace has 7 datafiles. Other configuration is kept as default, such as no maxsize, no MAXPIECESIZE, and etc setting.
I read document from Oracle. It says:"By default a backup set contains one backup piece. To restrict the size of each backup piece, specify the MAXPIECESIZE option of the CONFIGURE CHANNEL or ALLOCATE CHANNEL commands. " And also, maxopenfiles configure does not force another backup piece generated. So, why do I get another backup piece?
BTW, I tried this on another testing environment. I only get one backup piece even there are more than 2 times maxopnefiles datafiles.
View 7 Replies
View Related
Oct 16, 2012
i created one table which has id with number datatype for which i created sequence and stored procedure so suppose i inserted two row there it's inserting and id is showing 1, 2 again i truncate that table and again i inserted value there now the id is starting from 3 , 4 so my question is that after truncating table can't it insert from 1 in id column?
View 11 Replies
View Related
Nov 2, 2012
I have found there is a wearied of email generated from my database. I have the data base server located in US (estern time) and the sysdate in the database is AUSTRALIA (AEST). But i am working from India (IST).I have one procedure, which will send email to some recipients once the job is done. It is using UTL_SMTP for sending the email from database.
Now problem is, the email i got from this procedure has a different timestamp which is NOT matching to any of the times:
Time in Mail : 2-Nov-2012 9.56 PM
IST Time : 2-Nov-2012 10.56 AM
Easter Time : 2-Nov-2012 01.30 AM
AEST Time : 2-Nov-2012 4.30 PM
View 1 Replies
View Related
Jul 27, 2010
I just completed a capture and I am trying to calibrate the workload but I get this error and I have not info about it.
I chmod the dir to 777 (just to make sure it wasn't permission) My sid is set to the correct db. Oracle_home, etc are set.
wrc MODE=calibrate REPLAYDIR=.
Workload Replay Client: Release 11.2.0.1.0 - Production on Tue Jul 27 14:59:33 2010
Copyright © 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Errors in file :
ORA-15557: workload replay client cannot access the replay directory or the database version do not match the preprocessing one
View 3 Replies
View Related
Aug 31, 2013
DB version: 11.2.0.3
I have enabled the below trace event before running query on my session.
ALTER SESSION SET events = '19027 trace name context forever, level 0x1000';ALTER SESSION SET tracefile_identifier = store_trace;
Then I ran my query, and upon the finishing of the query, I ran the below to disable trace.
ALTER SESSION SET events = '19027 trace name context off, level 0x1000';
Now I checked back on the trace folder in my Oracle DB directory structure, but cannot find any file created by using the above set tracefile_identifier. I had previously run the query with "sql_trace" ON with tracefile_identifier, and successfully got the tracefile generated by using the identifier.
View 4 Replies
View Related
Feb 17, 2012
This generates a CSV file in an directory. When it runs for the 1st time it take SYSDATE -7 data. After the 1st run it appends the data since the last run. Now my problem is the appending happens at the bottom of the file and every time the header appears. I want the header only the first time and the new data should keep appending at the top so that i get the latest data always at the top.
View 18 Replies
View Related
Jan 31, 2013
I'm looking for errors in alert.log, I thought that every "ORA-XX" would be a incident in adrci, but "i have missed" some ORAS-XX
I have a wrong job in my test environment which generates an ORA-12012 every 5 minutes. If we chech the alert.log trace we can see that there is a recor every five minutes (more of less)
oooo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo
adrci> show alert -tail 2
2013-01-31 12:59:01.901000 +01:00
SMCO started with pid=23, OS id=20719
2013-01-31 13:00:23.033000 +01:00
Errors in file /u01/app/oracle/diag/rdbms/xe/XE/trace/XE_j000_20765.trc:
ORA-12012: error on auto execute of job "TEST"."WRONG_JOB"
ORA-04063: package body ""TEST"."WRONG_JOB"" has errors
ORA-06508: PL/SQL: could not find program unit being called: ""TEST"."WRONG_JOB""
[code].....
But, if we look for for incidents
oooo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo--oo
adrci> show incidents
ADR Home = /opt/oracle/diag/rdbms/xe/XE:
*************************************************************************
INCIDENT_ID PROBLEM_KEY CREATE_TIME
-------------------- ----------------------------------------------------------- ----------------------------------------
23393 ORA 600 [kzsviver:1] 2012-09-27 09:19:55.054000 +02:00
23394 ORA 600 [kzsviver:1] 2012-09-27 09:20:13.540000 +02:00
23409 ORA 600 [kzsviver:1] 2012-09-27 09:56:35.688000 +02:00
[code].....
This ORA-12012 doesn't appears.
View 8 Replies
View Related
Nov 16, 2010
I was looking for a way to see if a default value for a procedure was passed NULL or it got NULL by default. [URL]
View 11 Replies
View Related
Dec 7, 2011
Whenever any transaction happen in database redo has generated for this transaction. Do select statement treat as a transaction as it doesn't modify any thing in database. And If select statement should not be a transaction, there should not be any redo generation for select statement.
So is select statement generate redo? If yes then Why ?
View 1 Replies
View Related
Aug 9, 2011
Calling function
select PACK.MAIN('blah') from dual
generates:
ORA-14551: cannot perform a DML operation inside a query
ORA-06512: at "SYSADM.NEW_QUANTUM_PACK", line 756
ORA-06512: at "SYSADM.NEW_QUANTUM_PACK", line 245
Unfortunately the Body is not accessible to see.The spec of the function is:
FUNCTION MAIN (mvar IN varchar2) RETURN varchar2; I read somewhere that I can call it like:
var myVar VARCHAR2; call PACK.MAIN('blah') into :myVar
But this generates: ORA-01008: not all variables bound
View 3 Replies
View Related
Oct 2, 2013
I am trying to find out if there is a definite way to find out (by querying database) which database users have been created by Oracle (either during installation or as part of patching or adding new feature) and which database users have been created by DBAs.
I have looked into the documentation but could not find anything relevant. Ideally, I would like to know if this can be done for any versions starting from 9iR2.
View 7 Replies
View Related
Sep 14, 2003
I Just got Oracle 9i installed. But can not login . What are the Default username and password for "Oracle9i Discoverer Administrator" and other Developers Suite apps?
Also What URL should i type to access the "iSQL *PLUS" through my browser, so that i can execute my SQL statements.
View 3 Replies
View Related
May 31, 2010
how many default users available in oracle 9i version.
View 4 Replies
View Related
Aug 18, 2013
I have a table called cust_file, his table consists of a lot of columns (one of these columns called cus_tax) and have a lot of data,I use oracle 11g, I want to change the default value of the column cus_tax to be equal 1, I wrote
ALTER TABLE cust_file MODIFY(cus_tax DEFAULT 1); table alteredbut
after I inserted new data to test the operation, I found that the new record has a value
= null for the column cus_taxthen
I tested using the following query select
data_default from all_tab_columns where table_name='CUST_FILE' and column_name='CUS_TAX'; no rows selected...
Change the default value of the column cus_tax.
View 3 Replies
View Related
Jul 5, 2012
trying to do impdp but getting error
UDI-22303: operation generated ORACLE error 22303
ORA-22303: type "SYS"."DBMSOUTPUT_LINESARRAY" not found
ORA-00600: internal error code, arguments: [kokaocr], [], [], [], [], [], [], [], [], [], [], []
ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_OUTPUT"
ORA-06512: at line
View 2 Replies
View Related
Aug 3, 2010
How to disable the Default Menu Items like (Edit - copy,Paste) in oracle Forms 10g.
View 1 Replies
View Related
Mar 6, 2011
I installed Oracle 11g and created a test database in that the default count should be 4196... but it is 4143.. some packages are missing.. even when i'm creating materialized view it is showing some error that packages are missing. what can i do for that? Is my oracle s/w corrupted ? even when i downloaded from oracle site it also shows the same count.
View 1 Replies
View Related
Feb 25, 2011
What is the Default Path of Log File after Import Dump in Oracle 10g.
View 1 Replies
View Related
Jun 11, 2013
I have a table like below:
tableA
aid des
1 concrete
2 wood
3 straw
4 plastic
5 fiber glass
6 other
tableB
bid material
01 1
02 2
03 3
01 2
01 2
02 3
01 5
The result I need when updating another table with this info is:TableC
edw_id bid Requirement
021 1 concrete, wood, fiber glass
032
025
123
521
I do not want :
concrete, concrete, concrete, wood, wood, fiber glass
SO far I am using the following but since I am dealing with hundreds of column that has the same material, when using listagg() from oracle 11.2g, they column width is too wide to fit into the required column.
update eris_data_work e set E.flex37 =
(select
LISTAGG(CM.des, ',') WITHIN GROUP (ORDER BY CM.des) AS casing_material
from CODE_CASING_MATERIAL CM, TBLCASING CA
where CM.code=CA.MATERIAL and CA.well_id=E.owner_oid AND CM.DES IS NOT NULL
GROUP BY CA.well_id)
where E.source='WWIS_ON'
I have even used the regexp_count() to try to eliminate duplicates however I have had no success so far
View 4 Replies
View Related
Jun 17, 2008
I have a table1:
userid, name, town.
Now i want to do a self join like:
select a.name, b.name, a.town
from table1 a
inner join table1 b
on a.town = b.town
where a.first_name <> b.first_name AND
a.last_name <> b.last_name
i added the where clause to limit duplicates i would get but i still get duplicates eg. A B london, B A london etc.
View 9 Replies
View Related
Feb 14, 2012
I have to load 50 Million records in a table. I also need to ensure that no duplicate records enter. Business demand is that It may send 2 Million records today, 1 Million records tomorrow, 3 million records on the next day and so on...
I have loaded 6 Million records into the table, but onwards speed of loading records (with duplicate check) is decreasing.
View 16 Replies
View Related
Jul 19, 2010
I have need, where I need to pick-up the one of the records out of 2, which have all the fields same but one key column? how should I do it?
sample data:
IDnamecreation dateupdate date
121233ATR7/19/2010 15:307/19/2010 15:30
1213344MTR7/19/2010 15:307/19/2010 15:30
For most of the cases, i am picking latest data using update date, but here where dates are same, I am stuck.
View 2 Replies
View Related
Sep 19, 2013
db and dev 10g rel2 ,suppose that i have a table with a lot of duplicate rows ,what i need is to delete the duplicates and retain one row of these duplicates . likecolumn -- with those values...how to delete two (hi's) and retain the third , ?it is all applied to all the duplicate values in the column.
View 5 Replies
View Related
Mar 24, 2011
remove duplicates from my collection(table type).Or an alternate solution for my issue is get clean data into my collection which i am not able to get to either.
Object creation
create table testingtype_table(ordernumber number,org_id number , company_name varchar2(10))
insert into testingtype_table values (1124,2424,'cbaaa');
insert into testingtype_table values (1124,2424,'cbaaa');
create or replace type testingtype_obj as object (ordernumber number,org_id number , company_name varchar2(10));
create or replace type testingtype_tab as table of testingtype_obj;
Code Block
declare
l_testingtype_tab testingtype_tab := testingtype_tab();
begin
select distinct testingtype_obj(ordernumber
,org_id
,company_name)
bulk collect into l_testingtype_tab
from testingtype_table;
end;
If only i can get a way to bulk collect only distinct values into the table type that will just do great but when i try the above (with distinct highlighted in red) it throws an error
ORA-22950: cannot ORDER objects without MAP or ORDER method
View 4 Replies
View Related
Oct 11, 2013
Removing duplicates from a string that contains years and "-".
Example: 1988-1997-2000-2013-1998-1965-1997-1899
I know this can be done in regular expressions but have no experience in this subject.
select REGEXP_REPLACE(.....) from dual;
View 16 Replies
View Related
Aug 3, 2011
i have two tables
Quote:
Table has following data.
id indicator
---------------
1 A
2 A
3 A
Quote:
Table2 has
id indicator
---------------
1 X
1 X
2 X
3 X
I would like to have following output ( Am running query on Toad)
t1_id t1_indicator t2_id t2_indicator
---------------------------------------------
1 A 1 X
1 X
2 A 2 X
3 A 3 X
View 4 Replies
View Related
Aug 17, 2012
I have a requirement with source table has duplicates so i need to select a row based upon the below condition.
Source table
EMP_NO ENAME SALARY CODE EMP_ID
1 TOM 1000 1 10
1 JOHN 2000 A 20
1 SAM 3000 A 30
2 TOM 500 1 40
2 SUNG 1500 1 50
Desired Output
EMP_NO ENAME SALARY CODE EMP_ID
1 TOM 1000 1 10
2 SUNG 1500 1 50
I tried with MAX and DENSE_RANK but its not getting me the first row.
View 8 Replies
View Related