Suppress auto sequence and trigger DDL for surrogate keys?
Is there a way to suppress trigger and sequence creation for surrogate keys when export to DDL file?
I know most of the time the automatic sequence and trigger creation is welcome and very handy.
However I'm migrating from an old Designer model and there only the needed sequences are created.
They have a different name and trigger logic is custom (and generated outside designer).
There is a lot of package code depending on this. So I prefer to create and use different sequences.
Is there a way to achieve this? Any tips are welcome.Create
Hi,
Note that generating the DDL for Oracle 12c means that it will attempt to use your Oracle 12c Physical model. So if you normally use Oracle 10g or 11g, you will find that any details from your Oracle 10g or 11g Physical Model will not be included. So this approach may have other implications for you.
If you are not using Oracle 12c, there are some relevant properties on the Auto Increment tab of the Relational Model properties dialog for the Column which may help:
Sequence Name - allows you to specify the name of the Sequence (which can be the name of a Sequence defined in the relevant Physical Model).
Trigger Name - allows you to specify the name of a Trigger (which can be the name of a Trigger that is defined for the Table in the Physical Model).
Generate Trigger - unsetting this will stop the Trigger being generated.
David
Similar Messages
-
Creation of sequence and trigger for each table!!!!!!!1
Hi
I am new to trigger and Sequence field. In one of my database we have many tables with fields for specifing ID numbers. Iam planning to insert the ID field with help of a Sequence and trigger...that trigger fires by adding the sequence value from the dual table. Now the point is here we r having around *60* table with ID field. And i am planning use the above process for each table by creating sequences and trigger for each table.
Will this affects the performance of database.
Is there any other option other than the above process, I mean other than creating sequences and trigger for each table.
PLzz help to resolve this issuee......
Shiyas
Edited by: user13170361 on Jun 7, 2010 12:37 AMTiger, I didn't mind about your comment, but the point is try to use
select NVL(max(a) + 1,1) into i from p1_temp;This line in your trigger code and see what is happening. The problem is with your trigger. You are using group by function and you will not get no_data_found !
For more help, this is some modification of your code.
SQL> create table p1_temp (a number(10) primary key, b number(10));
Table created.
SQL> create or replace trigger trg_p1_temp
2 before insert on p1_temp for each row
3 declare
4 i number(10);
5 begin
6 begin
7 select NVL(max(a) + 1,1) into i from p1_temp;
8 exception
9 when no_data_found then
10 i := 1;
11 end;
12 :new.a := i;
13 end;
14 /
Trigger created.
SQL> insert into p1_temp(b) values (1);
1 row created.
SQL> insert into p1_temp(b) values (2);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from p1_temp;
A B
1 1
2 2
SQL> Edited by: Saubhik on Jun 7, 2010 2:30 AM -
Do Auto Save and Version work for Office for Mac-documents?
Do Auto Save and Version work for "Office for Mac 2011"-documents?
No, just certain Apple apps right now. Preview, iWorks, textedit come to mind. Anything else?
-
DataModeler v3.3.0 - Naming standards template for surrogate keys creation
I'm using DM 3.3.0.734 and in the logical model we now can define in the entity properties to "Create Surrogate Key".
When we use Engineer to relational model, for each entity is automatically created a new column using the naming template {entity}_ID as NUMERIC (without precision) and is defined as primary key.
My questions are:
Is possible to define a different naming standard for surrogate key creation?. We define id_{entiry}
Is possible to set the precision of NUMERIC surrogate key?
If we define entity's column as Primary UID, these columns are included in an unique constraint, but are using the naming standards for PK.
As consequence are created the following:
Unique constraint name: entity_PK
Primary key(surrogate)name: entity_PKv1
There is any way to define naming standards like "{entity}_UID" for unique constraints, or even, "{entity}_SK" for surrogate primary key name?
Can anyone help with some of these topics?
Regards,
Ariel.Hi Ariel,
Naming standards template for surrogate keys creation I logged enhancement request for that.
How to change those bad names (going to change them one by one is not an option):
1) If those "transformed" unique keys are the only ones you have in relational model then simply can apply naming standards
2) You can write transformation script to do that for you
3) you can use new functionality - search, export to excel file, change the names there (using find/replace will be faster) and return changed data back to relational model
you can find description for that here:
https://apex.oracle.com/pls/apex/f?p=44785:24:13179871410726::NO:24:P24_CONTENT_ID,P24_PREV_PAGE:6621,16
http://www.thatjeffsmith.com/archive/2012/11/sql-developer-data-modeler-v3-3-early-adopter-search/
http://www.thatjeffsmith.com/archive/2012/11/sql-developer-data-modeler-v3-3-early-adopter-collaborative-design-via-excel/
You should search for _PK, then filter result on Index and you can export result using report functionality (to XLS or XLSX output format). You can create template and include only table and name (of index) as properties to be included into report.
Regards,
Philip -
I am using Oracle 11.2.0.3. What is the best practice for choosing data type for surrogate key?
In my work place , I see other developers using NUMBER or INTEGER.
Thanks.ranit B wrote:
The above is called the Ingenuity+ of Sir Frank Kulash.
<snip>
You gotta love the subtleties of language and culture. :-)
To simply address someone as 'Sir' (as in "Sir, would you mind ...?" or simply "Yes, Sir" and "No, Sir") is a sign of respect.
But when "Sir" is used as a title by prefixing it to a name ("Sir Frank Kulash"), it is taken as an official title - specifically that of Knighthood, conferred by the British Crown.
ranit - Please don't think I'm calling you to task on this. Without a doubt, your English is better than my whateveryournativelanguageis. I always get a grin when someone inadvertently tries to confer Knighthood on someone, as it happens a lot around here. But it's a slow day at my office. Of course I quickly spot when something gets mangled in English. I've often wondered what kinds of mangling native English speakers do when they learn another language.
;-) -
Oracle jdbc creating a table, sequence and trigger
I'm trying to create a table with a sequence and with a trigger for that sequence. When I do this within Oracle Express edition I have the following SQL statements. Which DO run correctly inside Oracle Express using the same user I log in with JDBC.
CREATE table "TEST" (
"ID" NUMBER(10) NOT NULL,
"NAME" VARCHAR2(20),
constraint "TEST_PK" primary key ("ID")
CREATE sequence "TEST_SEQ"
CREATE trigger "BI_TEST"
before insert on "TEST"
for each row
begin
if :NEW."ID" is null then
select "TEST_SEQ".nextval into :NEW."ID" from dual;
end if;
end;
So now what I do is put each of these into a List of Strings and execute 1 by one like this:
List<String> commands = new ArrayList<String>(4);
commands.add("Create table ...");
commands.add("Create sequence ...");
commands.add("Create trigger...");
st = con.createStatement();
for (String command : commands) {
st.execute(command);
etc...
But I get an error with the trigger statement. "Error with Oracle command: ORA-00942: table or view does not exist"
It seems to me that Oracle has not yet seen the new table at this point. or maybe my user can create tables but not triggers? If that's the case why did it work in the express application itself?
TIASproketBoy wrote:
But I get an error with the trigger statement. "Error with Oracle command: ORA-00942: table or view does not exist"Keep in mind: Oracle is not lying to you.
>
It seems to me that Oracle has not yet seen the new table at this point. or maybe my user can create tables but not triggers? If that's the case why did it work in the express application itself?No, DDL commands cause an explicit commit. As soon as you invoke them, the change is permanent. If it was a rights problem, you'd get a different ORA error stating that, it won't silently fail.
Lets not assume it is anything difficult, perhaps there is simply a typo in a name somewhere? -
Hello,
Ia have created a Sequence and a trigger
The Sequence ïs:
CREATE SEQUENCE "WABO"."WABO_VERG_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 ORDER NOCYCLE;
The trigger is:
create or replace
TRIGGER WABO.WABO_VERGUNNING_TRIC
BEFORE INSERT ON WABO.WABO_VERGUNNING FOR EACH ROW
WHEN (new.WABO_ID IS NULL) BEGIN
SELECT WABO_VERG_SEQ.NEXTVAL INTO :new.WABO_ID FROM dual;
END;
When I insert a row in the table the sequence counter is 21 and it's stay's 21 even when I insert a new row
When I cal the DDL it's showes me this
CREATE SEQUENCE "WABO"."WABO_VERG_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 21 CACHE 20 ORDER NOCYCLE;
What am I doning wrong.
ThanksSolved
-
How to use auto-increment and search option for MS Access DB
Dear All,
I have configured our invoice in Adobe Livecycle and connected it to MS Acess 2007 as per http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/.
All is working fine, I can insert, retrieve data from DB to invoice and vice versa.
Now I want few things to be implemented on our invoice.
When ever I open our invoice, it populate the first entry from DB, Is it possible to populate the last entry ?
Auto increment invoice number from MS Access DB every time we open our invoice after save.
How to implement search option from DB for invoice number ?
Please let me know if someone can provide me help on my scenario, so that I can share more stuff related to invoice and DB.
Look forward to hearing soon from experts and other team members.
Thanks & Regards
Riyad...As far as I know there is not any auto increment data type in Oracle. Instead of this you should create a sequence and get the next value of the sequence while creating a row in your table.
CREATE SEQUENCE Test_Sequence ;
CREATE TABLE Test_Table ( Id NUMBER , Foo VARCHAR2(4) ) ;
ALTER TABLE Test_Table ADD CONSTRAINT Test_Table_PK_Id PRIMARY KEY ( Id ) ;
INSERT INTO Test_Table ( Id , Information ) VALUES ( Test_Sequence.NEXTVAL , 'FOO' ) ; -
Sequence and Capture presets for 16x9 minidv
FCP 6.0.6
checking capture presets for sd mini dv shot in sd 16x9 (US).
what are proper sequence and capture settings?
in sequence setting - should frame size box remain ntsc dv (3:2) and then just check 16x9 anamorphic box?
in capture settings - frame size should it be ntsc dv (3:2) and then check 16x9 anamorphic box?
thanks in advanceGo to the menu Final Cut Pro > Easy Set Up and from the drop down menu choose USE: DV-NTSC Anamorphic.
Click Setup.
That will make all the correct settings at once.
MtD -
Auto login and report launch for Web Discoverer Plus?
What url format can I use to auto connect and launch a report in
the web version of Discoverer Plus?
I've been able to do this fine with Viewer and client/server
Plus...
Each time I try something it brings me back to the "start_ie.htm"I found the answer to my own question:
To login in "applicatino mode" you must login like this:
<app_user_name>:responsibility
OR
<app_user_name>:
Then you'll be prompted to choose a pre-assigned responsibilty. -
Auto number by sequence and trigger - issue
Hi,
i need to insert auto number in one of the column of my table, and i tried like the following way..
CREATE TABLE STOP_TRACKING
ID NUMBER primary key,
MSISDN NUMBER NOT NULL,
TIME_STAMP DATE DEFAULT SYSDATE,
STOP_TRACKING_RESULT NUMBER,
REQUEST_ID VARCHAR2(60 BYTE)
TABLESPACE SYSTEM
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
LOGGING
NOCACHE
NOPARALLEL;
COMMENT ON COLUMN STOP_TRACKING.STOP_TRACKING_RESULT IS 'IF RESULT ID "0" - OK AND IF RESULT ID "1" - NOT OK';
create sequence seq_autonumber;
CREATE OR REPLACE TRIGGER trg_autonumber
BEFORE INSERT ON STOP_TRACKING
FOR EACH ROW
WHEN (new.id IS NULL)
BEGIN
SELECT seq_autonumber.NEXTVAL
INTO :new.id
FROM STOP_TRACKING;
END;
/when i execute the create trigger sql in toad sql editor am getting a pop up saying
>
variable name:NEW
Type: drop down list ...here i tried almost relevant data types, int,long,....
Value:...here i entered 1
and clicked ok...and got the error as
ORA-01036: illegal variable name/number
>
what could be issue?
Edited by: Aemunathan on Nov 22, 2009 2:55 PMI just copy pasted your code.
Works just fine.
I believe you issue is realed to TOAD rather than pl/sql.
Would have loved to help you but i use pl/sql developer.
However if possible send a screen shot.
Cheers!!!
Bhushan -
Sequencing and Trigger on Oracle 9i lite database
We created a schema (TESTSCHEMA) on Oracle 8.1.7 Enterprise edition and have a created a trigger which will use the sequence object to generate primary key for the table (TEST_TABLE)
Sequence creation:
CREATE SEQUENCE TESTSCHEMA.TEST_TABLE_SEQUENCE START WITH 6000 INCREMENT BY 1 MINVALUE 6000 MAXVALUE 6999 NOCACHE NOCYCLE NOORDER ;
Trigger creation:
CREATE OR REPLACE TRIGGER TEST_TABLE INSERT BEFORE INSERT ON TEST_TABLE FOR EACH ROW
DECLARE
pkValue NUMBER;
BEGIN
pkValue := 0;
Select TEST_TABLE_SEQUENCE.NextVal into pkValue from dual;
:NEW.TEST_KEY := pkValue;
END TEST_TABLE_INSERT;
We have created a snapshot of the schema on mobile server, synchronized the data with the client (Win32 for testing purpose).
The trigger works fine on the server, but when I run the same query on the lite database with msql it gives me an error:
[POL-3221] null key in primary index
I was wondering if Sequence generation and Triggers are supported on Oracle 9i lite database ? Or am I missing out something ??
Any information/ help is appreaciated
Thanks
NeerajYou can't use SAVEPOINT / ROLLBACK TO SAVEPOINT statements in the database trigger:
ORA-04092: cannot SET SAVEPOINT in a trigger
ORA-04092: cannot ROLLBACK in a trigger
I am not sure what you need exactly, but you can try this:
Simulating ROLLBACK TO SAVEPOINT Behavior in a Database Trigger
http://www.quest-pipelines.com/pipelines/plsql/tips02.htm#JUNE
Regards,
Zlatko Sirotic -
Auto-Refresh and Order By for view accessors
Hi,
We have set auto-refresh to true on a VO(LovVO) in shared AM and used the same to create an lov in another VO. Now if we have Order By in LovVO then we get the exception:
ORA-29983: Unsupported query for Continuous Query Notification
This is because of the Order By clause. When i remove the order by then there is no error. But we need the data to be ordered. So I have added the below code LovVOImpl.java executeQueryForCollection method:
if(this.getSortBy() == null){
this.setSortBy("Name");
super.executeQueryForCollection(object, object2, i);
and this is working fine. Is there any other declarative solution for this scenario?
I tried setting the order by in the view accessor but that also appends to the sql query and throws the above error.
Thanks
ThiruPlease see http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_cqn.htm#CHDGEBFH. Look like OREDER By is supported only in Best-Effort mode.
When you call .setSortBy("Name"), it happens in memory not part of SQL, apparently that works -
Dbms_metadata and trigger ddl (db version 10g)
Hi all,
does anyone know if there is a parameter in procedure dbms_metadata.set_transform_param to get rid of the alter trigger enable clause that is automatically appended otherwise?
For other objects like table there is such possibility for constraints for instance, but I don't see triggers in the list of supported objects.
Thanks and Bye,
FlavioHi All,
According to the support, we update the column flag in mlog$ to fix the issue due to the Bug 12849688.
Now, DBMS_METADATA.get_dependent_ddl can return the right result.
However, the old data in the materialized view log cannot be cleared after different kinds of refresh including fast, complete and force etc.
Any idea?
Thanks for your help -
Sequence and number scale for PK's
For PK's that use a sequence, is it better to use NUMBER(*,0) versus NUMBER. Is there some effeciency to be gained?
Thanks, sck10Thanks SomeoneElse.
sck10
Maybe you are looking for
-
E-Mail Signature Grey and Single Line after PR1.2 ...
Hi After having updated my N900 to PR1.2, I now find that when I reply to, or create a new message in the standard e-mail client , my automatic signature is inserted in grey instead of black, and all linefeeds are left out so the whole thing appears
-
I was working on DB 8i with forms 6i & i upgrade the data base with export/import on data base 9i there is no problem with the data except a blob column is working good with the data imported but when i try to store a new image the db9i accepted and
-
Searching for Easy DMS documents using embedded search
Dear Experts, we are using easy dms to manage documents. As far as I know it should be possible to index these documents using TREX. -it is possible to perform a search for these documents using Embedded Search an get the search results as XML (a doc
-
SRM 7. 0 with ECC 6.0 Enhancement Pack
1) My client just upgraded their R/3 to ECC 6.0, but no Enhancement Pack. 2) They are trying to upgrade from SRM 5.0 to SRM 7.0 in the near futures. 3) During their first SRM phase, their scenario is limited to the following: a. R/3 RFQs are pushed t
-
Please help on SO_NEW_DOCUMENT_ATT_SEND_API1
Hi Gurus I have to attach data in excel format, but getting a pbm here. I am using the following code.. can anyone suggest on this please.. docdata-obj_name = 'AUTOSEND'(m01). docdata-obj_descr = trpt-text. "report title docdata-expiry_dat