Create Trigger (PK from Sequence) in SQL Developer 1.5.1

Hi all
I'm new to Oracle and am trying to create the equivalent of an autonumber field on a table using the Create Trigger (PK from Sequence) option (by right clicking on a table in SQL Developer).
I've set up a sequence called REQUESTID and when using the above option it generates the following SQL:
begin
execute immediate 'create or replace trigger AutoNumber '||
     ' before insert on "REQUEST" '||
     ' for each row '||
     'begin '||
     ' if inserting then '||
     ' if :NEW."REQUESTID" is null then '||
     ' select REQUESTID.nextval into :NEW."REQUESTID" from dual; '||
     ' end if; '||
     ' end if; '||
     'end;';
     end;
When I click Apply I get an ORA-00942 (table or view does not exist). Am I doing something daft here?

Never mind - sorted it - I created the table under a different Schema to the System login being used in SQL Developer and so didn't have the permissions to create the trigger on the table.

Similar Messages

  • How to create database link from oracle to sql server

    Please help with how to create database link from oracle to sql server
    Best regards,
    Vishal

    Please help with how to create database link from oracle to sql server
    Best regards,
    Vishal
    Hi Vishal,
    I found a lof of information regarding how to create a database link from Oracle to SQL Server, please see:
    https://www.google.co.in/?gws_rd=cr&ei=vd3XUvGFO8TgkAXqlYCADg#q=how+to+create+database+link+from+oracle+to+sql+server
    We discuss SQL Server related issue in this forum. If you have any more question regarding Oracle, please post it in Oracle communities forum for better support.
    Regards,
    Elvis Long
    TechNet Community Support

  • Creating A New Oracle Database And Sql Developer

    Hi,
    I'm a newbie to Oracle and and a not so newbie to Sql Server and Visual Studio.
    I am trying to learn Oracle on my local machine. I want to create a new Oracle Database and start learning from there.
    I have downloaded sql developer, the data modeler, and the Oracle Client. Could someone please provide some guidance on how to create a Oracle Database?
    From the responses, it appears that none of the items I mentioned actually creates a database. Sql Server provides a free download, also a developer version for a minimal fee. What specific Oracle product would be best to provide this type of service?
    Thanks,
    Mark
    Edited by: user8948230 on Jan 7, 2010 9:50 AM

    user8948230 wrote:
    Hi,
    I'm a newbie to Oracle and and a not so newbie to Sql Server and Visual Studio.
    I am trying to learn Oracle on my local machine. I want to create a new Oracle Database and start learning from there.
    I have downloaded sql developer, the data modeler, and the Oracle Client. Could someone please provide some guidance on how to create a Oracle Database?
    From the responses, it appears that none of the items I mentioned actually creates a database. Sql Server provides a free download, also a developer version for a minimal fee. What specific Oracle product would be best to provide this type of service?
    Thanks,
    Mark
    Edited by: user8948230 on Jan 7, 2010 9:50 AMIn addition to downloading and installing the database software to create a database, might I also suggest you start getting familiar with the documentation.
    Learning where to look things up in the documentation is time well spent investing in your career. To that end, you should drop everything else you are doing and do the following:
    Go to tahiti.oracle.com. Drill down to your product and version.
    Spend a few minutes just getting familiar with what is available here. Take special note of the "books" and "search" tabs. Under the "books" tab you will find the complete documentation library.
    Spend a few minutes just getting familiar with what kind of documentation is available there by simply browsing the titles under the "Books" tab.
    Open the Reference Manual and spend a few minutes looking through the table of contents to get familiar with what kind of information is available there.
    Do the same with the SQL Reference Manual.
    Do the same with the Utilities manual.
    You don't have to read the above in depth. They are reference manuals. Just get familiar with what is there to be referenced. Ninety percent of the questions asked on this forum can be answered in less than 5 minutes by simply searching one of the above manuals.
    After you have familiarized yourself with what is available, read the "2-Day DBA" manual to help get you started.
    Then set yourself a plan to dig deeper.
    - Read a chapter a day from the Concepts Manual.
    - Look in your alert log and find all the non-default initialization parms listed at instance startup. Then read up on each one of them in the Reference Manual.
    - Take a look at your listener.ora, tnsnames.ora, and sqlnet.ora files. Go to the Network Administrators manual and read up on everything you see in those files.
    - When you have finished reading the Concepts Manual, do it again.
    Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.

  • Create a cursor from a PL/SQL variable or an external file

    Dear friends,
    is there a way for me to make Oracle Forms read a cursor from a PL/SQL variable, or an external file? Let's suppose we have the code below:
    DECLARE
    cursor c_values is select * from my_table;
    r_values c_values%ROWTYPE;
    BEGIN
    for r_values in c_values loop
    do_something;
    end loop;
    END;
    In the situation described above, could I create "select * from my_table" from a PL/SQL variable (it could be something like p_cursor = 'select * from my_table'), or an external file - for example, make my form read the contents of c:\my_select.sql , where we see the "select * from my table" text?
    My question comes because I need to export data from select instructions that were dinamically created inside the form - that is, via PL/SQL -, and I don't want to rewrite it, but I'll have to do it if I have no choice. Your help will be greatly appreciated.
    Best regards,
    Franklin
    Edited by: franklinbrasil on 12/03/2009 11:33
    Edited by: franklinbrasil on 12/03/2009 11:35

    Dear friends,
    I am using DBMS_SQL package, which solved my problem. Please let me explain it better, if it's not clear.
    I have some PL/SQL blocks inside my form, which creates SQL queries dinamically, and a dinamically created SQL is stored into a VARCHAR2 variable. These SQL queries are exported for use in Oracle Graphics, but since OG is not being developed by Oracle anymore then I am trying to find a substitute for it.
    So I thought about creating an option for the final user: he/she can choose exporting data into Microsoft Excel, and user does what he/she wants, creating a customized graphic. Exporting into Excel works finely, with no problems at all - I could find a routine by searching on the web.
    My goal was to use the same queries created above to export data dinamically to Microsoft Excel, and I absolutely don't want to rewrite all these dinamically created queries - one which works dinamically, other with no flexibility inside my form. Worse than it, I have many other dinamically created queries, and I obviously don't want to rewrite them all - any maintenance in this form would be terrible, with each SQL instruction written twice.
    Since all dinamically created SQL instructions are stored inside a VARCHAR2 variable, I thought about reusing the same SQL, as explained above - and here we have your suggestions about using a ref cursor, execute immediate, and so on. And (answering Andreas) query structure is always based on the same table, but its structure changes a lot, depending on what the final user chooses in a drop-down list (it's a list of graphics options, where final user chooses one option, and form must mount SQL dinamically, based on user's choice).
    By using your explanations, I could find DBMS_SQL solution here: http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg09dyn.htm#26799
    . Please notice that I had to change DBMS_SQL.native into 1 for it to work in my form. I'll mark all your answers as helpful because I can use them both for database and form purposes.
    If my message was not clear enough, please tell me and I'll try to make it more clear.
    Best regards,
    Franklin

  • From TOAD to Sql Developer

    Hi,
    I've been a TOAD user for more then 5 years, now our office is switching us to SQL Developer. Is there a way, in SQL Developer, to display the content of a REF CURSOR? If so, how is it done?
    Thanks in advance,
    Marc

    Hi Marc,
    From SQL Developer's Help menu (used version 3.0.04.34), just click on Search and enter "ref cursor". One result with a nice REF CURSOR example is "Cursor Variables". Scroll down to "Example: Fetching Data with Cursor Variable".
    Or read more about it on the SQL and PL/SQL forum:
    PL/SQL 101 : Understanding Ref Cursors
    Or, as a quick example, create a function in the SCOTT schema that returns a sys_refcursor:
    create or replace function get_employees return sys_refcursor as
    ret_cursor sys_refcursor;
    begin
    open ret_cursor for
    select * from emp;
    return ret_cursor;
    end get_employees;
    Then, from a worksheet, use Run Script (the Run Statement produces a hard-to-read result for the select) on:
    select get_employees() from dual;
    or...
    variable v_ref_cursor refcursor;
    exec :v_ref_cursor := get_employees();
    print :v_ref_cursor
    Regards,
    Gary Graham
    SQL Developer Team
    Edited by: gggraham on Jul 28, 2011 1:44 PM

  • Creating Database Link from Oracle to SQL Server

    I am trying to create a database link from Oracle to SQL Server, and the documentation is about as clear as mud to me. Can anyone send me clear instructions on exactly what I need to do? What needs to be in tnsnames.ora and listener.ora files? Is there anything other than those two files that needs to be set up? Do I set up an ODBC connection? Anything else? I want to execute queries against a SQL Server database and load data into Oracle database.
    Thanks so much,
    Susan

    These are the instructions from an old document I created. The steps are same for SQL Server and Sybase. Hope it helps.
    The 9i Transparent Gateway Software is in Oracle Software CD -> oracle9i database -> Custom -> Oracle Transparent Gateways
    The gateway can be installed on the same machine as the Oracle database or
    on the Sybase server or on a third machine as a stand-alone.
    We have installed the gateway software in one of oracle database
    servers in a separate oracle home.
    These are the steps involved in configuring a gateway to a Sybase database
    1.     Install Sybase client and Gateway software on the Gateway Server
    2.     Configure <initsidfile> in the Gateway Server's <gatewayhome>
         /u00/app/oracle/product/9.2.0/tg4sybs/admin/init<gatewaysid>.ora
    Sybase server and database information is required for this step.
    eg: HS_FDS_CONNECT_INFO=USTRUD01.uwd
    3.     Add an entry in listener.ora in <listnenerhome>
         (/u00/app/oracle/product/9.0.1/network/admin/listener.ora) for the <gatewaysid>
    4.     Edit the tnsnames file (/u00/app/oracle/product/9.0.1/network/admin/tnsnames.ora)
    to add an entry <tnsalias> for the <gatewaysid>
    5.     Create a database link to the Sybase database in the oracle database.
    The steps for creating the database link are
    a. create a login oracle_tgw in the sybase server
    b. add the user to the sybase database with the necessary privilege on the tables
    c. create the database link in the required oracle database using the command
         "create public database link <dblinkname> connect to oracle_tgw identified by password using 'tnsalias'; "
    6.     Restart the gateway listener.

  • Migration from Access with SQL Developer 1.2.2998 Does not migrate Relation

    Hi,
    I've almost successfully migrated an Access database to Oracle with SQL Developer with Quick Migration Option. Everything went all right, except for the tables relationships... they were not migrated. Have I forgot to do something?
    Thanks in advance.
    PS: Using SQL Developer 1.2.0.29.98, Oracle 10g XE, MS Access 2000 file.

    Hi All,
    This is a bug which crept in just prior to release. It has been found, and a fix has been commited to our source tree. The fix will be available in our next patch release. (1.2.1).
    Regards,
    Dermot.

  • Pausing and resuming a PL/SQL proc from oracle PL/SQL DEVELOPER tool

    I need to test a PL/SQL on how it reacts to an exception. I need to PAUSE it, do something outside of the proc and then resume the proc. Is there a PROMPT command in PL/SQL where it would wait for user input? Can I use DBMS_OUTPUT.GET_LINE to do this? Where does the GET_LINE raed its input from?

    Perhaps the following demo will help. It uses straight SQL, since the PRIMARY KEY stuff does not require any sort of PL/SQL.
    I set up 2 sessions in SQLPlus.
    Session 1 - create a table with a primary key, insert and do not commit:
    session 1:
    C:\Users\Hans>sqlplus test/test
    SQL*Plus: Release 10.2.0.1.0 - Production on Sat Oct 10 15:40:13 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> create table abc ( a number primary key enable);
    Table created.
    SQL> insert into abc values (1);
    1 row created.Go to session 2 and insert:
    C:\Users\Hans>sqlplus test/test
    SQL*Plus: Release 10.2.0.1.0 - Production on Sat Oct 10 15:36:45 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> insert into abc values (1);it hangs here.
    Switch back to session 1 and commit;
    SQL> commit;
    Commit complete.
    SQL>and in session 2 I see
    insert into abc values (1)
    ERROR at line 1:
    ORA-00001: unique constraint (TEST.SYS_C006468) violated
    SQL>Trying this for different test cases: session 1 insert value (2) and session s, insert value (3)
    Session 1
    SQL> insert into abc values (2);
    1 row created.
    SQL>Session 2
    SQL> insert into abc values (3);
    1 row created.
    SQL>Back to session 1
    SQL> commit;
    Commit complete.
    SQL>Back to session 2
    SQL> insert into abc values (3);
    1 row created.
    SQL>So I conclude that dups will block during insert.
    For your original question - SQL and PL/SQL are run in separate engines. PL/SQL sends the SQL command to the SQL engine, which runs that and returns any return info (rowset, error, ...).
    So any questions about SQL and SQL transaction control may be handled in a purely SQLPlus (or TOAD or SQLDeveloper) test case.
    OTOH, questions about PL/SQL can be answered using a debug environment such as SQLDeveloper - see http://www.oracle.com/technology/obe/sqldev/plsql_debug/plsql_debug.htm

  • Creating Database link from Oracle9i to SQL server 2000

    Pls how do I create connectivity from Oracle9i database to query a table in an SQL server 2000 database.
    Pls I need the necessary steps to take.
    Thanx

    There are 2 solutions that you can use:
    1) Transparent Gateway for SQL Server
    2) Generic Connectivity
    Generic Connectivity is free with the database but has less features than the Gateway. For Generic Connectivity you will need to obtain an ODBC driver.
    The steps for using the gateway are available in the gateway manual and the steps for using Generic Connectivity is available in Chap 7 of the Heterogeneous Connectivity Administrator's Guide.

  • SQL Developer import from Excel or CSV not creating new table

    I am sure I have done this with previous version of SQL Developer. I am now running 1.5.4 with patches update from 5/27/2009. I am running on Windows XP. When I start the import wizard I get to the point were the varify button appears. I click Verify. Everything is successful. The next button is grayed out. The send to worksheet is not checked. I press the finish button and the new table is not created.
    I don't get any error message. I refresh my table list and the new table is not created. I can create new tables using SQL Developer so I don't think it can be a privelege problem. I know I did this a few weeks ago. I am not sure what version of SQL Developer I was running. But I have updated to the latest and greatest since then.

    I wanted to import and use my table data from MS Excel 2010 in SQL developer Version 3.1.05.
    I was told that SQL does not import .xls data. For that reason, I was searching for a script which Import data from excel to SQL developer. I tried many different forums DBS blogs. Then eventually I found the solution inside the SQL developer itself.
    In your Editor window, There would be options like,
    1. Columns | Data | Constraints |Grants | Sta...... "so on"
    2. In second row, you can find a drop box with certain table options. Select the last option "Import Data"
    THERE YOU GO.
    do accordingly to your need and you will get the data as well its scripts.
    I hope this would help you all. Thanks. :-)

  • SQL Developer Error Creating User Home

    SQL Developer was running fine on my Windows 7 64-bit machine until Monday morning. Now when I kick it off (from my Desktop shortcut), I get a small box saying: "Error creating user home in directory C:\Users\<username>\AppData\Roaming\SQL Developer".
    There is no error number, and I have been unable to find this error in the SQL Developer documentation. What does it mean? It's possible that updates were pushed to my machine over the weekend (unknown -- network sysadmins are elsewhere), but I would have thought I would have gotten a different message if there were compatibility problems. Have I accidentally deleted a necessary file from my local SQL Developer folder? My connection databases are Oracle 11g.
    Thanks for any suggestions.

    Hi,
    Here is a thread on the same issue, but so old that the advice it gives is no longer accurate:
    Re: Error creating user home in directory D:\Program Files\raptor\jdev.
    So let's assume you no longer have write access to your own Windows user directory. To workaround that just add the following to one of the conf files in the SQL Developer installation folder. For example, to run SQL Developer from a flash drive, I modified my E:\sqldeveloper\ide\jdk.conf to include
    AddVMOption -Dide.user.dir=../../.sqldeveloperSo that the user home is E:\.sqldeveloper
    Regards,
    Gary
    SQL Developer Team

  • Trigger information not showing up in SQL Developer

    I cannot get any "trigger" information to display in SQL Developer when I click on the "Triggers" tab for a table in which I KNOW has at least 1 DBA_TRIGGERS
    entry. Has anyone else experienced this ? Is this a bug ? I have the "patch 2"
    version installed. All other tabs give me output (e.g. Grants, Contraints, etc.).

    user524670,
    I'm sorry you feel we're not active on the forum, we're a small team ;-)
    There are a number of excellent responders on this forum and many questions have previous responses about bugs or ERs logged. Remember this is a community forum and I think it is doing exceedingly well as one.
    You can definitely log an SR with Support and ask them to give this priority. However, you'll have seen from earlier posts that the statement of direction for SQL Developer is now available. We do not plan to release a patch 3, as we are focused on release 1.1, due out in the next few months.
    Sue

  • Migration from Access to Oracle through SQL developer

    Hi,
    I want to migrate an mdb file which contains a set of tables to oracle. During this process, i have created schema and all the tables in Oracle using DDL scripts. I would like to transfer only the data to Oracle from access through SQL developer. How can I do that?
    Regards,
    Meena

    Hi Meena,
    You mention that you have created the schema and tables in Oracle using DDL scripts. Did you use the Oracle SQL Developer Migration Workbench, creating a Migration Repository, to carry out this process? I see from your other postings that you are experiencing issues using the Exporter tool, which would lead me to believe that you haven't used the Migration Workbench to migrate your database. Obviously you will need to resolve your Exporter issues before you can proceed to the next phase of the migration process. I will aim to assist you with those issues on the seperate thread - ShowSplashScreen("_OracleSplashScreen",3) error The XML file generated by the Exporter tool forms the basis of your MS Access migration.
    In order to migrate your data from MS Access to Oracle using the Migrate Data option in Oracle SQL Developer, you will need to have access to the Migration Repository used for the migration of the MS Access database. The information contained in the Converted Model, in the Migration Repository, is used during the data migration process. The data migration requires the following connections:
    1. a source database connection i.e. a database connection to the MS Access MDB file
    2. a target database connection i.e. a database connection to the migration Oracle schema
    3. a Converted Model connection
    For further information on the creation of a Migration Repository, and the migration process, please refer to the accompanying documentation available via the online Help within Oracle SQL Developer, and also from OTN - http://download.oracle.com/docs/cd/E10405_01/doc/nav/portal_booklist.htm.
    I hope this helps.
    Regards,
    Hilary

  • SQL Developer from JDev

    I am doing the « Database Development with JDeveloper » tutorial. In the tutorial we create two SQL scripts that we can run with SQL*PLUS from inside JDEV. The tutorial asks us to use sqlplusw.exe. However I don’t have sqlplusw, I only have sqlplus.exe, the command line version.
    When I saw SQL Developer was claiming “Oracle SQL Developer is a graphical version of SQL*Plus” (First sentence of Online Help), I naively thought that I could use sqldeveloper.exe instead of sqlplusw.exe.
    When I try to run the SQL script from JDEV, it seems to open an empty SQL Developer window in JDEV, with no possibilities of running scripts.
    I know that in the next version of JDev SQL Developer should be integrated but, in the mean time does anyone know a way to open and run a SQL script from JDEV using SQL Developer as the tutorial requires it?
    I'm not sure if this makes sense.
    Message was edited by:
    dfullum

    You can use the sqlplus.exe instead of the sqlplusw.exe the results should be the same.

  • SQL Developer  Create Table Statement to ERD Visio Diagram

    I have the following Create table statement from SQL Developer and I am trying to generate an ERD Diagram using 2003 Visio. I was wondering what I need to do to convert the Create Table to an ERD Diagram Using Visio. Thanks
    CREATE TABLE “TT_TEAM”.”HR_REVOKED_SECURITY_ORGS”
    “ID” NUMBER NOT NULL ENABLE,
    “ACAT_CODE” VARCHAR2(6 BYTE) NOT NULL ENABLE,
    “APPR_SEQ_NO” NUMBER(3,0) NOT NULL ENABLE,
    “USER_ID” VARCHAR2(30 BYTE) NOT NULL ENABLE,
    “ACTION_IND” VARCHAR2(1 BYTE) NOT NULL ENABLE,
    “ACTIVITY_DATE” DATE NOT NULL ENABLE,
    “COAS_CODE” VARCHAR2(1 BYTE),
    “ORGN_CODE” VARCHAR2(6 BYTE),
    “POSN” VARCHAR2(6 BYTE) NOT NULL ENABLE,
    “MANDATORY_APPR_IND” VARCHAR2(1 BYTE),
    “APPR_POSN” VARCHAR2(6 BYTE),
    “ORGN_MANAGER” VARCHAR2(6 BYTE) NOT NULL ENABLE;

    I'm pretty Visio is a non-Oracle product.
    In the mean-time, you can easily import a DDL script file and create a relational model/diagram using SQL Developer. Use the Import feature and point to your CREATE TABLE script(s)

Maybe you are looking for