Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ACCESS MIGRATION

730241Oct 26 2009 — edited Oct 27 2009
When migrating a database from Access to Oracle, and using NOT the "Quick Migration" (doing the whole thing from scratch), I notice an error (a logic one) in the generated trigger statement for simulating the auto-incremental field functionality.

Firstly, in some conditions, the triggers gets into an almost infinite loop, only stoping when reachs the upper limit of the sequence. If I'm not mistaken, it happens when the related table already has some/many records/rows on already (I don't remember).

And secondly, the original trigger logic imposes that the sequence value of 1 (one) will never happen.

Here follows the original trigger code:

CREATE OR REPLACE TRIGGER tab_14_eqdsmd1_fld_sqd1_TRG BEFORE INSERT OR UPDATE ON tab_14_eqdsmd1
FOR EACH ROW
DECLARE
v_newVal NUMBER(12) := 0;
v_incval NUMBER(12) := 0;
BEGIN
IF INSERTING AND :new.fld_sqd1 IS NULL THEN
SELECT tab_14_eqdsmd1_fld_sqd1_SEQ.NEXTVAL INTO v_newVal FROM DUAL;
-- If this is the first time this table have been inserted into (sequence == 1)
IF v_newVal = 1 THEN
--get the max indentity value from the table
SELECT max(fld_sqd1) INTO v_newVal FROM tab_14_eqdsmd1;
v_newVal := v_newVal + 1;
--set the sequence to that value
LOOP
EXIT WHEN v_incval>=v_newVal;
SELECT tab_14_eqdsmd1_fld_sqd1_SEQ.nextval INTO v_incval FROM dual;
END LOOP;
END IF;
-- save this to emulate @@identity
msaccess_utilities.identity := v_newVal;
-- assign the value from the sequence to emulate the identity column
:new.fld_sqd1 := v_newVal;
END IF;
END;

/


And here is the "fixed" code for the same trigger:

CREATE OR REPLACE TRIGGER tab_14_eqdsmd1_fld_sqd1_TRG BEFORE INSERT OR UPDATE ON tab_14_eqdsmd1
FOR EACH ROW
DECLARE
v_newVal NUMBER(12) := 0;
v_incval NUMBER(12) := 0;
BEGIN
IF INSERTING AND :new.fld_sqd1 IS NULL THEN
SELECT tab_14_eqdsmd1_fld_sqd1_SEQ.NEXTVAL INTO v_newVal FROM DUAL;
-- If this is the first time this table have been inserted into (sequence == 1)
IF v_newVal = 1 THEN
--get the max indentity value from the table
SELECT nvl(max(fld_sqd1), 0) INTO v_newVal FROM tab_14_eqdsmd1;
v_newVal := v_newVal + 1;
--set the sequence to that value
LOOP
EXIT WHEN (v_incval>=v_newVal) or (v_newVal=1);
SELECT tab_14_eqdsmd1_fld_sqd1_SEQ.nextval INTO v_incval FROM dual;
END LOOP;
END IF;
-- save this to emulate @@identity
msaccess_utilities.identity := v_newVal;
-- assign the value from the sequence to emulate the identity column
:new.fld_sqd1 := v_newVal;
END IF;
END;

/

These only two changes seem to fix things and make them work as expected.

Hope you can change these for the next release. I make tens of migrations every month and fixing it manually is sometimes boring and error prone.

[]'s

Roger Reghin
Petrobras - Brazil

Comments

trent
Hi Scott,

If you open the developer toolbar, you will notice the document mode is: IE9 standards.

Change this to: Standards and it works fine.

I'm not very guru'ey in IE stuff, but there must be something in the template forcing it to go into IE9 mode. The hunt begins!
trent
Answer
Couldn't find anything to suggest it should force ie9 standards.

But adding the following to the page header seems to clear that and actually load in Standards mode.
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
I do note that the apex builder pages are all loaded in IE9 Standards mode as well, which I find a little odd.

It is worth checking out the following:

http://msdn.microsoft.com/en-us/library/ms533876%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx
*Note Edge mode is intended for testing purposes only; do not use it in a production environment.*
Because it forces all pages to be opened in standards mode, regardless of the version of Internet Explorer, you might be tempted to use this for all pages viewed with Internet Explorer. Don't do this, as the X-UA-Compatible header is only supported starting with Windows Internet Explorer 8.
Tip If you want all supported versions of Internet Explorer to open your pages in standards mode, use the HTML5 document type declaration, as shown in the earlier example.>

Although, everywhere seems to suggest using edge mode (StackOverflow, etc)

http://stackoverflow.com/questions/5374099/how-do-i-force-internet-explorer-to-render-in-standards-mode-and-not-in-quirks
http://webdesign.about.com/od/metataglibraries/p/x-ua-compatible-meta-tag.htm
"IE=edge" tells Internet Explorer to use the highest mode available to that version of IE. Internet Explorer 8 can support up to IE8 modes, IE9 can support IE9 modes and so on.
Edited by: trent

Excuse all my edits! It looks like the !html5 test just below the opening head tag does not pass, which is where it should set browser mode to standards. I'd say just to take it out of there and put it in the if gte IE9 bit, so:
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="&BROWSER_LANGUAGE."><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  <!--<![endif]-->
Marked as Answer by Scott Wesley · Sep 27 2020
Scott Wesley
Thanks Trent, from what I read I figured the issue would be something to do with those headers - but you've interpreted it nicely for me.

Scott
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 24 2009
Added on Oct 26 2009
1 comment
520 views