Need some help in debugging this exported script

Below is DDL generated by visio forward engineering tool . The example below consists of 2 test tables with one foreign key.
Forward engineering generated DDL script
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table1]') AND type in (N'U'))
DROP TABLE [dbo].[Table1]
GO
CREATE TABLE [dbo].[Table1] (
[test] CHAR(10) NOT NULL
, [test2] CHAR(10) NULL
GO
ALTER TABLE [dbo].[Table1] ADD CONSTRAINT [Table1_PK] PRIMARY KEY CLUSTERED (
[test]
GO
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table2]') AND type in (N'U'))
DROP TABLE [dbo].[Table2]
GO
CREATE TABLE [dbo].[Table2] (
[test2] CHAR(10) NOT NULL
GO
ALTER TABLE [dbo].[Table2] ADD CONSTRAINT [Table2_PK] PRIMARY KEY CLUSTERED (
[test2]
GO
GO
ALTER TABLE [dbo].[Table1] WITH CHECK ADD CONSTRAINT [Table2_Table1_FK1] FOREIGN KEY (
[test2]
REFERENCES [dbo].[Table2] (
[test2]
GO
GO
When i converted this DDL script using scratch editor the migration tool gave some errors can anyone help me to resolve below
DECLARE
v_temp NUMBER(1, 0) := 0;
BEGIN
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE EXISTS ( SELECT *
FROM objects
WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table1]')*/
AND TYPE IN ( N'U' )
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
TRUNCATE TABLE Table1;
END IF;
END;
CREATE TABLE Table1
test CHAR(10) NOT NULL,
test2 CHAR(10)
ALTER TABLE Table1
ADD
CONSTRAINT Table1_PK PRIMARY KEY( test );
--SQLDEV:Following Line Not Recognized
DECLARE
v_temp NUMBER(1, 0) := 0;
BEGIN
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE EXISTS ( SELECT *
FROM objects
WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table2]')*/
AND TYPE IN ( N'U' )
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
TRUNCATE TABLE Table2;
END IF;
END;
CREATE TABLE Table2
test2 CHAR(10) NOT NULL
ALTER TABLE Table2
ADD
CONSTRAINT Table2_PK PRIMARY KEY( test2 );
--SQLDEV:Following Line Not Recognized
ALTER TABLE Table1
ADD
CONSTRAINT Table2_Table1_FK1 FOREIGN KEY( test2 ) REFERENCES Table2 (test2)
--SQLDEV:Following Line Not Recognized
;

Pl do not post duplicates - Need some help in debugging this script

Similar Messages

  • Need some help in debugging this script

    Below is DDL generated by visio forward engineering tool . The example below consists of 2 test tables with one foreign key
    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table1]') AND type in (N'U'))
    DROP TABLE [dbo].[Table1]
    GO
    CREATE TABLE [dbo].[Table1] (
    [test] CHAR(10) NOT NULL
    , [test2] CHAR(10) NULL
    GO
    ALTER TABLE [dbo].[Table1] ADD CONSTRAINT [Table1_PK] PRIMARY KEY CLUSTERED (
    [test]
    GO
    GO
    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table2]') AND type in (N'U'))
    DROP TABLE [dbo].[Table2]
    GO
    CREATE TABLE [dbo].[Table2] (
    [test2] CHAR(10) NOT NULL
    GO
    ALTER TABLE [dbo].[Table2] ADD CONSTRAINT [Table2_PK] PRIMARY KEY CLUSTERED (
    [test2]
    GO
    GO
    ALTER TABLE [dbo].[Table1] WITH CHECK ADD CONSTRAINT [Table2_Table1_FK1] FOREIGN KEY (
    [test2]
    REFERENCES [dbo].[Table2] (
    [test2]
    GO
    GO
    When i converted this using scratch editor the migration tool gave some errors can anyone help me to resolve below
    DECLARE
    v_temp NUMBER(1, 0) := 0;
    BEGIN
    BEGIN
    SELECT 1 INTO v_temp
    FROM DUAL
    WHERE EXISTS ( SELECT *
    FROM objects
    WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table1]')*/
    AND TYPE IN ( N'U' )
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END;
    IF v_temp = 1 THEN
    TRUNCATE TABLE Table1;
    END IF;
    END;
    CREATE TABLE Table1
    test CHAR(10) NOT NULL,
    test2 CHAR(10)
    ALTER TABLE Table1
    ADD
    CONSTRAINT Table1_PK PRIMARY KEY( test );
    --SQLDEV:Following Line Not Recognized
    DECLARE
    v_temp NUMBER(1, 0) := 0;
    BEGIN
    BEGIN
    SELECT 1 INTO v_temp
    FROM DUAL
    WHERE EXISTS ( SELECT *
    FROM objects
    WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table2]')*/
    AND TYPE IN ( N'U' )
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END;
    IF v_temp = 1 THEN
    TRUNCATE TABLE Table2;
    END IF;
    END;
    CREATE TABLE Table2
    test2 CHAR(10) NOT NULL
    ALTER TABLE Table2
    ADD
    CONSTRAINT Table2_PK PRIMARY KEY( test2 );
    --SQLDEV:Following Line Not Recognized
    ALTER TABLE Table1
    ADD
    CONSTRAINT Table2_Table1_FK1 FOREIGN KEY( test2 ) REFERENCES Table2 (test2)
    --SQLDEV:Following Line Not Recognized
    ;

    Welcome to the forum!
    Whenever you post you need to provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    >
    Below is DDL generated by visio forward engineering tool . The example below consists of 2 test tables with one foreign key
    When i converted this using scratch editor the migration tool gave some errors can anyone help me to resolve below
    >
    Not familiar with either of those tools but they appear to be producing such garbage as to not be useful at all. You may want to try using sql developer and the data modeler module.
    The reason I say that is that this code (notice that since I put \ on the line before and after the code it preserved the formatting)DECLARE
    v_temp NUMBER(1, 0) := 0;
    BEGIN
    BEGIN
    SELECT 1 INTO v_temp
    FROM DUAL
    WHERE EXISTS ( SELECT *
    FROM objects
    WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table1]')*/
    AND TYPE IN ( N'U' )
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END;
    IF v_temp = 1 THEN
    TRUNCATE TABLE Table1;
    END IF;
    END;
    CREATE TABLE Table1
    test CHAR(10) NOT NULL,
    test2 CHAR(10)
    This code appears to check if table1 exists. Then if the table exists it TRUNCATEs it. But then it attempts to CREATE the table.
    Well - you can't have it both ways. If the table exists you can't create it.
    If this code is typical of what your tools are producing you need to either use another tool (e.g. sql developer) or do the conversion manually.
    You can download sql developer here
    http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • The backup disk image "/Volumes/Data/David Witkowski's Mac Pro.sparsebundle" is already in use.  Whenever Time Machine starts to backup to Time Capsuel I get the previous error message. I need some help to fix this.

    The backup disk image “/Volumes/Data/David Witkowski’s Mac Pro.sparsebundle” is already in use.  Whenever Time Machine starts to backup to Time Capsuel I get the previous error message Where can I find this disk image?. I need some help to fix this.
    Thanks,
    David W

    There are multiple answers and solutions if you look just to the right under the heading of More Like This.

  • HT201210 at the end of iOS6 download,my ipod touch says 'update failed'.i need some help to resolve this problem. thanks

    at the end of iOS6 download,my ipod touch says 'update failed'.i need some help to resolve this problem. thanks

    Try:
    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Next connect to iTunes and update via iTunes. Others have had the same problem.

  • My iphone 4 has switch of itself, and cant switch on its blankout , i need some help to solve this matter, My iphone 4 has switch of itself, and cant switch on its blankout , i need some help to solve this matter

    i need some help! my i phone has switch off totally blank as if there is no baterry, i cant wsitch on anymore, i live in Africa whereby there is no any  apple offises arroung, i want to find a solution thats why i am asking for the help

    Plug in iPhone with Wall Charger for 10 minutes, it may turn on itself. If not, keep on Wall Charger and Reset, hold both Home and Power buttons until the iPhone begins to restart. This usually takes less than 20 seconds of holding both buttons.

  • Need some help in building a PowerShell Script

    I am in the process of setting up continuous self-auditing on a set of computers that are on a Domain. My company has a restriction on use of USB devices as well as CDs/DVDs. The domain pushes patches but we have been seeing some users that are using (or
    trying to) the network without becoming a part of the domain. My aim is to run a PowerShell script periodically (say, hourly) on each computer on the domain and dump certain parameters to XML / XHTML and then load these onto a web-server that can display the
    results in a (sort of) dashboard to flag anomalies like unauthorised USB use etc.
    I know there must be some commercial products for this but the boss says "No" to a purchase. 
    Am I on the right track or do I need to change my approach? Also, is there a starting scirpt available somewhere so that I can study it for techniques? My major problem is the display part. I am able to dump it into XML and (sort of ) format it but how do
    I collate the data and display it as a web-page is what is bothering me. Help would be deeply appreciated.

    @JRV:
    Users don't have to be domain administrators
    to be able to install software. Local admin is more than enough. ie: I am no admin in the domain of my customer but am allowed to install software
    Although I agree with you, in the sense it would be easier to restrict the users, it doesn't mean that a company has to do it that way; and it certainly doesn't represent the intelligence of an individual. 
    @SarabRSingh:
    What you are asking for is a lot of work, to get the script right (considering the special demands, ie. AV update checking is different depending on the SW) and it might require a lot of resources on the client.
    From what you describe, you want to prevent any USB/Optical Media use. You should consider Group Policies to manage that. http://technet.microsoft.com/en-us/library/bb742376.aspx
    The only part I would script (based on my work environment) is the checking of AV updates (gets tricky because our SW has a hard time forcing the user to update when connected by VPN).
    user log in / out --> group policy: logon/off script writing appending timestamp to a file
    has he/she used any USB device --> if you want to block it: GPO, if you only want to track it: powershell
    Get-WmiObject Win32_USBControllerDevice
    has any new application / software been installed: restrict installation completely with user permissions or: http://social.technet.microsoft.com/Forums/en-US/f4dc8ab9-370b-423e-b65d-1fa46fa9bcc4/powershell-script-to-remotely-audit-computers-on-lan?forum=ITCG
    was the AV: no idea on what you are using (maybe: http://serverfault.com/questions/129611/how-to-detect-when-antivirus-is-out-of-date-with-powershell
    OS updated: WSUS http://technet.microsoft.com/en-us/library/cc708519(v=ws.10).aspx
    If you found this post helpful, please "Vote as Helpful". If it answered your question, remember to "Mark as Answer"
    MCC & PowerShell enthusiast
    http://oliver.lipkau.net/blog

  • I need Some help to complete this program

    i write this program to call file from my hard drive "the file name is
    input.tex" "the program the file and the result for the program are below"
    please read the program and the file befor you read my question
    now, i need to use 3 arrays
    1) first array to read this part
    include[0]: VAR ZRO 1
    include[1]: +0000000000
    include[2]: VAR I 1
    include[3]: +0000000000
    include[4]: VAR SUM 1
    include[5]: +0000000000
    include[6]: VAR AVG 1
    include[7]: +0000000000
    include[8]: VAR N 1
    include[9]: +0000000000
    include[10]: VAR TMP 1
    include[11]: +0000000000
    include[12]: VAR DTA 990
    include[13]: +0000000000
    in this way
    VAR ZRO 1
    VAR I 1
    VAR SUM 1
    VAR AVG 1
    VAR N 1
    VAR TMP 1
    VAR DTA 990
    2) second array is dimensional array to read this part
    include[15]: READ N
    include[16]: LABL 20
    include[17]: READ TMP
    include[18]: GE TMP ZRO 40
    include[19]: SUB ZRO TMP TMP
    include[20]: LABL 40
    include[21]: PUTA TMP DTA I
    include[22]: LOOP I N 20
    include[23]: MOVE ZRO I
    include[24]: LABL 50
    include[25]: GETA DTA I TMP
    include[26]: ADD TMP SUM SUM
    include[27]: LOOP I N 50
    include[28]: DIV SUM N AVG
    include[29]: PRNT AVG
    include[30]: STOP
    in this way
    READ N
    LABL 20
    READ TMP
    GE TMP ZRO 40
    SUB ZRO TMP TMP
    LABL 40
    PUTA TMP DTA I
    LOOP I N 20
    MOVE ZRO I
    LABL 50
    GETA DTA I TMP
    ADD TMP SUM SUM
    LOOP I N 50
    DIV SUM N AVG
    PRNT AVG
    STOP
    3) the third to read this part
    include[32]: +0000000005
    include[33]: +0000000020
    include[34]: -0000000430
    include[35]: +0000000553
    include[36]: +0000001323
    include[37]: -0000000896
    in this way
    +0000000005
    +0000000020
    -0000000430
    +0000000553
    +0000001323
    -0000000896
    i hope i see some help
    [http://arbshare.net/files-182969.html]

    According to the file name ending with extension .tex, I guess that it's TeX, a markup language, not a programming language.
    Topicstarter: look for a more suitable forum. Good luck.

  • HT3702 i set an itunes account up with my visa debt card and its taken the money out of my account i need some help to sort this please

    Can some one help me by ring me from itunes please

    This is a User to User Forum...
    You need to Contact iTunes Customer Service
    Apple  Support  iTunes Store  Contact Us

  • I need some help, plz read this

    i am using Java API for SNMP called SNMP4j, and using netbeans as IDE for JAVA and my project is abt getting the MPLS VPN information from cisco routers MIB called PPVPN-MPLS-VPN-MIB, i need to get the information in all of the eight tables in this mib using SNMP API as i already said, im interested to get the entire tables, whereas i can get only the first row of each table.
    if someone knows that how can i access the whole table or how would i know that how many number of rows are there in each table then i would be able to do what is intended.
    my problem is related to SNMP objects instance identification,
    please please, reply as soon as possible, thanking in anticipation.

    Hi,
    Welcome to the forum!
    This site replaces multiple whitespace with a single space by default, so things that are nicely formatted when you post them look terrible after you post them.
    Type these 6 characters
    {code}
    (small letters only, inside curly brackets) before and after formatted text, to preserve spacing.
    Re-arranging your one-column output into three columns is called pivoting.
    Here's one way to do it:
    WITH     got_rnum
    AS
         SELECT     ename
         ,     LENGTH (ename)     AS len
         ,     ROW_NUMBER () OVER ( PARTITION BY  LENGTH (ename)
                                   ORDER BY          ename     -- optional
                           )  AS rnum
         FROM     scott.emp
    SELECT       MAX (CASE WHEN len = 4 THEN ename END)     AS length_4
    ,       MAX (CASE WHEN len = 5 THEN ename END)     AS length_5
    ,       MAX (CASE WHEN len = 6 THEN ename END)     AS length_6
    FROM       got_rnum
    GROUP BY  rnum
    ORDER BY  rnum;The only place where I had to know what the lengths were was when I wrote three lines for the SELECT clause (for lengths 4, 5, and 6).
    If you the query to do this, then you have to use dynamic SQL, to figure out how many different lengts there are, and what they are, and to write an appropriate SELECT clause for you.
    As dynamic SQL gioes, this is pretty easy. You can do it in SQL*Plus or PL/SQL.

  • Need some help in ARCHITECTURE level for upgrading SAP BW 3.5 to SAP BI 7.0

    HI all,
    I am a consultant in a small company, i am curently handling upgradation project i need some help in ARCHITECTURING this complete project, please share me your knowledge, like process flows what information i need to get from clients before starting the project, what is pre upgradation checks, post upgradation cheks  ...............
    Thanks in advance.............

    Hi,
    You need to confirm the downtime during the upgrade activity.
    Check for Space and resource allocation.
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8d1a0a3a-0b01-0010-eb82-99c4584c6db3
    https://wiki.sdn.sap.com/wiki/display/BI/UpgradefromBW3.XtoBI7.0+%28SP13%29
    https://wiki.sdn.sap.com/wiki/display/BI/Migrationof3.xobjectstoBI7.0
    You need to make sure some OSS notes should be applied, check the below link for the same:
    https://wiki.sdn.sap.com/wiki/display/BI/UpgradetoNetWeaverBI7.0%28SAPNotes+%29
    http://wiki.sdn.sap.com/wiki/display/BI/BIUpgradation-HelpfulOSSnotesfromEDWperspective
    Hope this helps...
    Rgs,
    Ravikanth.

  • Need some help, system won't boot now.

    Yesterday, I was having trouble getting WinXP installed on my SATA drive...after I tried some stuff to no avail, I decided to call it a night.  When I got up, I went to boot up the system and now all that happens is the 1 LED light flashes and the CD-ROM LED light flashes(and even these don't happen all the time).  Nothing else happens, fans don't start etc.  So I need some help on troubleshooting this prob.  When I do start it up, the D-bracket LEDs flash 4 red also, just flash like the other LED lights.  My first guess would be that the PSU is dead?  My PSU is a Antec Truepower 380W.  Any help is much appreciated.

    Believe Bas; As he is 100% Correct, as even 18 Amps is not anywhere enough on the +12V Rail nowadays, I mean I think the New "Minimum" Should be No Less than 25 Amps on the +12V Rail, With these new Powerful Vidio Cards, that Require thier own "Molex" Power Supply Connected to them (As most of these Top Nvidia FX, and ATI Pro's) Need and they can demand up to 6 Amps themselves, I mean, these Cards Have 400 and 550MHZ GPU's on them with over 100 Million Transistors, Not to mention the Extra 256MB of High Speed Graphics memory, Add this with a New 64BIT CPU, and a Sound Card, and a Couple of S-ATA's in RAID, And the 1GIG of High Speed System RAM, and you Are At or Over 18 Amps Already , And we are not even talking CD and DVD's or the At least 4 Fans that you should have ...Yep I for one say the Day's of the 18 Amp Min. Rating for the +12V Rail are Gone Forever...Why do you think that all the Really Good PSu's have At Least 30 Amp Ratings on thier +12V Rails......And in the Case of Enermax, They even went as Far to Start Building thier PSU's With 2 (Dual) +12V Rails ...Thats right, Now they have a +12V-1, and a +12V-2 , Now the CPU gets it's OWN Dedicated +12V Rail, and the System Gets the +12V-2 Rail.......I just got the new Enermax for my 3RD Rig that I'm Building (Dual Opteron 248) Rig , with Bas's Help of Coarse.....But For $99.00 US  It was the Best Money spent yet, so much, for a little Price, as the Antec Units are More expensive...And I hear that they are doing a little Cheating on thier Amp Ratings these Days ..Ask "Wonk" he will tell you...  ..............Sean REILLY875

  • Hi, can anyone help me out with this, I need some help on designing GUI for e-learning coursewares. Some tutorials or some helpful sites will do.

    I need some help with the GUI design.

    Have you tried the line inputs on the back of your FirePod? If you update its firmware (not sure if you will need to or not), I seem to remember hearing that the FirePod can run without FW connection, i.e. stand alone. In this mode with the outs from your mixer into line ins 1-2 (2nd from left on the back) it should work fine. I say should because I have never tried. However, these are used for returns from an external effects unit. I assume here, and the important word is assume, that there are two so that they can be used as a stereo send or as a mono send. Worth a try! Let us know how it goes.
    Best, Fred

  • Ok i have indesign CS6 and all files are stored on a 10.7.5 MAC server.  This just started happening.  When I open a file indesigns is creating a textfile in the same folder?  I need some help on this.

    Ok i have indesign CS6 and all files are stored on a 10.7.5 MAC server.  This just started happening.  When I open a file indesigns is creating a textfile in the same folder?  I need some help on this.

    Ask in the ID forum and be much more specific about your configuration. there could be any number of reasons why manifests, temp files or restore files are created.
    Mylenium

  • I need some help. im getting error -69 when trying to sync my ipod. i dont kno what to do. ive tried googling as much info as i can on this but i cant seem to find a answer to get me off to a good starting point. i back all my music up on a hard drive.

    i need some help. im getting error -69 when trying to sync my ipod. i dont kno what to do. ive tried googling as much info as i can on this subject but i cant seem to find a answer to get me off to a good starting point. i back all my music up on a external hard drive.

    If the file was not originally from iTunes, you'll need to redownload it from it's original source or rerip it from the CD.  Files can sometimes go bad and become corrupted.  As to how or why that happens, there are a number of ways.
    What format are the problematic tracks in? Have you tried converting them to another format in iTunes?
    iTunes: How to convert a song to a different file format
    B-rock

  • This website make problem for me, he open by it self everytime i try to open another websites  Please i need some help

    this website make problem for me, he open by it self everytime i try to open another websites
    Please i need some help
    http://yandex.ru/yandsearch?text=ццц&lr=1004

    Dude, I don't think there's a user on this forum that would click on that link.

Maybe you are looking for

  • Applet in Netscape question.

    Hi, Applet in Netscape question. When an applet is run by Explorer everything is OK when trying to run with Netscape (7.1) nothing happening What is wrong here ??? <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "730" HEIGHT = "2

  • Problems with alt lang tags and SXMPIterators

    This is strange, if I iterate through all the properties and encounter alt lang XMP nodes such as dc:rights: <dc:rights> <rdf:Alt> <rdf:li xml:lang="x-default">Copyright Kent Sandvik, All Rights Reserved</rdf:li> </rdf:Alt> </dc:rights> The iterator

  • Conversion from Musicmatch Jukebox

    When I first got my iPod I was using Musicmatch (iTunes was unstable) and burned 1/2 my collection that way. Now my entire collection is there and everything is under iTunes (all in mp3 format). Using 'get CD track names' it will sometimes say - not

  • Spry XHR form not redirecting in DIV when using within SPRY TABPANEL

    I am able to use form submittion without full page refresh using XHR. But when i tried this in SPRY tabbed panel it is not working please help me in this regard. Below is the tabbed panel page and actual page that contains form. Attaching two files o

  • Grammar check in Mac Mail not working-Mavricks

    I am using MacBook Air 2012. OS X 10.1 Mavricks. I in Mac Mail when I go to Edit > Spelling and Grammar...the "Check Spelling and Grammar" tab is greyed out so I cannot set. Any ideas to fix that?