Can we declare primary as initially deferred deferrable

Hi,
Anyone know Can we declare primary as initially deferred deferrable...What is the syntax like?
Thank You....

Left's first look at the approach you use.. 2 SQL statements that can be done using a single SQL statement.
Actually it is not as bad as some other code posted here where people go and write complex PL/SQL code to do what could have been done using a single SQL statement.
There are a couple of golden rules in Oracle development. One of these is to 'Maximise SQL and Minimise PL/SQL'.
Why take a value from one SQL statement into PL/SQL and then use that value in a second SQL statement?
Rather do this:
select
fn into n
from table2
where id like (Select a from table1 where b like b_new);Also keep in mind that in PL/SQL the above SQL construct is only able to fetch a single row - look at the bold above. The variable N can only hold a single value. If that SQL SELECT returns more than one value, how is variable N suppose to hold it?
I suggest that you read [url http://www.oracle.com/pls/db102/to_toc?pathname=appdev.102%2Fb14261%2Ftoc.htm&remark=portal+%28Books%29]Oracle® Database PL/SQL User's Guide and Reference guide.

Similar Messages

  • INITIALLY DEFERRED DEFERRABLE

    What is the purpose of INITIALLY DEFERRED DEFERRABLE can any one explain?

    Hey Rajnish, This topic has been discussed recently:
    Follow this link:
    Re: Deferrable Unique

  • DEFERRABLE INITIALLY DEFERRED

    ALTER TABLE dept2
    ADD CONSTRAINT dept2_id_pk
    PRIMARY KEY (department_id)
    DEFERRABLE INITIALLY DEFERRED;
    I would like to know, what Its does this inially primary key?

    Your caps lock appears to be stuck. Perhaps rebooting will help.
    <p>
    I am not sure what the intent of the other poster was but there are situations were it is useful. See chiken-and-egg.

  • Deferrable initially deferred(immediate) has a bug?

    I execute these statements:
    1.alter table dept2
    add constraint dept2_id_pk
    primary key (department_id)
    deferrable initially deferred;
    2.set constraints dept2_id_pk immediate
    3.Alter session set constraints=immediate
    Then I test dept2:
    desc dept2
    Name Null? Type
    DEPARTMENT_ID NUMBER(4)
    DEPARTMENT_NAME NOT NULL VARCHAR2(30)
    MANAGER_ID NUMBER(6)
    LOCATION_ID NUMBER(4)
    Why department_id did not display NOT NULL???????
    I check the user_constraints:
    select constraint_name,constraint_type,search_condition from user_constraints where table_name='DEPT2';
    CONSTRAINT_NAME C SEARCH_CONDITION
    SYS_C005947 C "DEPARTMENT_NAME" IS NOT NULL
    DEPT2_ID_PK P
    :):):)

    It seems that your sequence of events does not update the nullable column of the dba_tab_columns. Not sure if this is a bug or the intended functionality when created deferrable.
    SQL> create table dept2(department_id varchar2(10), col2 varchar2(10) NOT NULL)
    Table created.
    SQL> alter table dept2
    add constraint dept2_id_pk
    primary key (department_id)
    deferrable initially deferred
    Table altered.
    SQL> set constraints dept2_id_pk immediate
    Set constraints complete.
    SQL> Alter session set constraints=immediate
    Session altered.
    SQL> insert into dept2 select null, 'A' from dual
    ORA-01400: cannot insert NULL into ("MSCALLION"."DEPT2"."DEPARTMENT_ID")
    SQL> select table_name, column_name, nullable
    from dba_tab_columns
    where table_name in ('T', 'DEPT2')
    TABLE_NAME                     COLUMN_NAME                    N
    DEPT2                          DEPARTMENT_ID                  Y
    DEPT2                          COL2                           N
    T                              C1                             N
    T                              C2                             N

  • Can i make exisitng Foreign key constraint deferrable?

    Hello, Is it possible to make the existing FK constraint deferrable? We can do this when we add New FK constraint. But i am not sure, we can make deferrable???
    scott@orcl> CREATE TABLE MASTER(id NUMBER(10));
    Table created.
    scott@orcl> CREATE TABLE child(id NUMBER(10), master_id NUMBER(10));
    Table created.
    scott@orcl>
    scott@orcl> ALTER TABLE master ADD PRIMARY KEY (id);
    Table altered.
    scott@orcl>
    scott@orcl> ALTER TABLE child ADD CONSTRAINT fk_master
    2 FOREIGN KEY (master_id)
    3 REFERENCES master(id)
    4 DEFERRABLE
    5 /
    Table altered.
    scott@orcl>
    scott@orcl> drop table child;
    Table dropped.
    scott@orcl> drop table master;
    Table dropped.
    scott@orcl>
    scott@orcl> CREATE TABLE MASTER(id NUMBER(10));
    Table created.
    scott@orcl> CREATE TABLE child(id NUMBER(10), master_id NUMBER(10));
    Table created.
    scott@orcl>
    scott@orcl> ALTER TABLE master ADD PRIMARY KEY (id);
    Table altered.
    scott@orcl>
    scott@orcl> ALTER TABLE child ADD CONSTRAINT fk_master
    2 FOREIGN KEY (master_id)
    3 REFERENCES master(id)
    4 /
    Table altered.
    scott@orcl> alter table child modify constraint
    2 fk_master deferrable;
    fk_master deferrable
    ERROR at line 2:
    ORA-00933: SQL command not properly ended
    scott@orcl>
    How can we make existing FK constraint as deferrable? Any help is appreciated....

    From Oracle doc
    Restrictions on Modifying Constraints
    Modifying constraints is subject to the following restrictions:
    You cannot change the state of a NOT DEFERRABLE constraint to INITIALLY DEFERRED.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_3001.htm#SQLRF01001

  • INITIALLY IMMEDIATE DEFERRABLE

    once again please help me what is the difference between this
    1)ALTER TABLE uclass
    ADD CONSTRAINT pk_uclass
    PRIMARY KEY (class_id)
    INITIALLY IMMEDIATE DEFERRABLE
    2)ALTER TABLE uclass
    ADD CONSTRAINT pk_uclass
    PRIMARY KEY (class_id)

    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/clauses002.htm#sthref2449
    Scroll down to "Specifying Constraint State"

  • Can not view primary layout

    I am using Robohelp HTML X5 build 584, with windows XP and
    IE6. I have used robohelp inthe past to generate web pages with
    help info which all worked well. I recently added new pages to the
    project and now it is not working. In the meantime I have
    transferred to a new pc and reinstalled robohelp and activated it,
    so maybe that isthe problem.
    When addinghe new web pages I can generate the primary layout
    but I can not view it. WHenj looking at the files created it is
    missing the main html page that shoudl be the ne that opens, plus
    some of the data and xdata folders inthe skins. I restored from
    backup a few thinjgs which I noticed wer missing but that does not
    seem to help.
    I created a brand new test project in case size was a
    problem, and added about 30 topics. Again it willnot view primary
    layout and does not create the main .htm page.
    Any ideas on how to fix?

    Hi Di W
    This certainly sounds as if RoboHelp isn't correctly
    installed or that you don't have sufficient permissions. I'd be
    checking with my IT staff to see if they recently changed anything
    from a security or permissions perspective. I'm not slamming IT, as
    they do have valid reasons for endlessly tweaking these settings,
    but it's quite common.
    You may also wish to review fellow Adobe Community Expert
    Peter Grainge's site by
    clicking
    this magickal link
    Cheers... Rick

  • How can i declare a single radio button field in selection-screen ?

    How can i declare a single radio button field in selection-screen ?

    >
    Rob Burbank wrote:
    > And how will you turn it off once it is turned on??
    >
    > Rob
    Thats correct ;)...See ravi if users will ask so many things its our Job to convay the correct solution ....
    Just post your org requirement..SOo some body guide you better//
    Sas

  • How do I set a specific page to open when I open a new tab in Firefox? I can open the page when initially opening Firefox, but not for subsequent tabs/pages.

    How do I set a specific page to open when I open a new tab in Firefox? I can open the page when initially opening Firefox, but not for subsequent tabs/pages.

    You can use an extension to set which page to open in a new tab:
    *NewTabURL : https://addons.mozilla.org/firefox/addon/newtaburl/
    *My Homepage: https://addons.mozilla.org/firefox/addon/my-homepage/

  • How can i declare a selection screen in a DP program with transaction code.

    hi friends,
    How can i declare a selection screen in a DP program with transaction code. What are the events and flow logic..

    Search in SCN/Google for Module-pool programming basics.

  • I recently added photoshop elements 12 to my computer but can't get past the initial log in screen. It goes gray and spins.  any thoughts?

    I recently added photoshop elements 12 to my computer but can't get past the initial log in screen. It goes gray and spins.  I have a current serial number and log in ID/password but still not working.  Any thoughts?

    Hello,
    I recommend you contact AT&T's dedicated BB Support staff (call their front line, request escalation to BB Support) and have them check to be sure that your account with them is correctly configured for this device. Sometimes when switching devices things don't fully automatically move behind the scenes, and only they (ATT) can validate that.
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Can we declare trigger in package

    Hi
    Can we declare trigger in package specification and body of trigger in package body. If so just give me the syntax.
    Thanks

    No. Just think: trigger would be firing on what? :-)
    But you can call (packaged) procedure from trigger.

  • Lower limit can only be changed during initial entry, Message no. NR651

    Hi Experts,
    As per the number ranges limit values defined in the system for the planned orders, there is a need to increase the number ranges.
    System is not allowing us to change the limit values of the Planned orders in MD91 and showing the Message no. NR651.
    We have also searched for the available threads in SCN and other sites, but didn't find the root cuase link for this error.
    System message:
    Lower limit can only be changed during initial entry
    Message no. NR651
    Diagnosis
    You have tried to change the lower limit of an interval which has a non-initial number status.
    System Response
    The change was not executed.
    Please guide us how can we increase the number ranges for planned orders.
    Thanks in advance.

    Hi,
    You can create a new number range or change in transaction OMi2 or in MD91.
    Assign the 02  by clicking number range in OMi2
    or in transaction OPPQ  click on number range & select the 02.
    Do the changes as described and analyse the results. Ensure that while testing no body is creating the planned orders.
    Regards,
    Narresh

  • Can we declare a Cursor in Package Specs?

    Dear buddies
    Can I Declare a Cursor in Package Specs so that I can call that cursor and use its data in some procedures and functions of package. Otherwise I've to write that cursor for every sub-program of a package which I don't feel a smart way to accomplish the job.

    Hi,
    here is a short example with the whole way down. Maybe the concept is getting clearer with this:
    first of all, if you do not have the table emp, here the DDL for this example.
    Be carefull, works only for german clients because of the names of months, sorry for that.
    CREATE TABLE EMP
    (EMPNO NUMBER(4) NOT NULL,
    ENAME VARCHAR2(10),
    JOB VARCHAR2(9),
    MGR NUMBER(4),
    HIREDATE DATE,
    SAL NUMBER(7, 2),
    COMM NUMBER(7, 2),
    DEPTNO NUMBER(2));
    set echo on
    INSERT INTO EMP VALUES
    (7369, 'SMITH', 'CLERK', 7902,
    TO_DATE('17-DEZ-1980', 'DD-MON-YYYY'), 800, NULL, 20);
    INSERT INTO EMP VALUES
    (7499, 'ALLEN', 'SALESMAN', 7698,
    TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600, 300, 30);
    INSERT INTO EMP VALUES
    (7521, 'WARD', 'SALESMAN', 7698,
    TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250, 500, 30);
    INSERT INTO EMP VALUES
    (7566, 'JONES', 'MANAGER', 7839,
    TO_DATE('2-APR-1981', 'DD-MON-YYYY'), 2975, NULL, 20);
    INSERT INTO EMP VALUES
    (7654, 'MARTIN', 'SALESMAN', 7698,
    TO_DATE('28-SEP-1981', 'DD-MON-YYYY'), 1250, 1400, 30);
    INSERT INTO EMP VALUES
    (7698, 'BLAKE', 'MANAGER', 7839,
    TO_DATE('1-MAI-1981', 'DD-MON-YYYY'), 2850, NULL, 30);
    INSERT INTO EMP VALUES
    (7782, 'CLARK', 'MANAGER', 7839,
    TO_DATE('9-JUN-1981', 'DD-MON-YYYY'), 2450, NULL, 10);
    INSERT INTO EMP VALUES
    (7788, 'SCOTT', 'ANALYST', 7566,
    TO_DATE('09-DEZ-1982', 'DD-MON-YYYY'), 3000, NULL, 20);
    INSERT INTO EMP VALUES
    (7839, 'KING', 'PRESIDENT', NULL,
    TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);
    INSERT INTO EMP VALUES
    (7844, 'TURNER', 'SALESMAN', 7698,
    TO_DATE('8-SEP-1981', 'DD-MON-YYYY'), 1500, 0, 30);
    INSERT INTO EMP VALUES
    (7876, 'ADAMS', 'CLERK', 7788,
    TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);
    INSERT INTO EMP VALUES
    (7900, 'JAMES', 'CLERK', 7698,
    TO_DATE('3-DEZ-1981', 'DD-MON-YYYY'), 950, NULL, 30);
    INSERT INTO EMP VALUES
    (7902, 'FORD', 'ANALYST', 7566,
    TO_DATE('3-DEZ-1981', 'DD-MON-YYYY'), 3000, NULL, 20);
    INSERT INTO EMP VALUES
    (7934, 'MILLER', 'CLERK', 7782,
    TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);2. Package Spec:
    create or replace
    package test_cursor as
      --Type for the returncode of the function
      TYPE typ_emp IS TABLE OF emp%rowtype;
      --Array for fetching, of course also possible in the body
      t_emp typ_emp;
      --function wich returns the array from fetching the cursor
      function get_emp return typ_emp;
      --function for manupilation data retrieved by the function
      PROCEDURE man_emp;
    end test_cursor;3. Package Body
    create or replace
    package body test_cursor as
      FUNCTION get_emp RETURN typ_emp AS
      cursor c_emp is select * from emp;
      BEGIN
        open c_emp;
        fetch c_emp BULK COLLECT INTO t_emp;
        CLOSE c_emp;
        --t_emp returns the whole table set from emp
        return t_emp;
      end get_emp;
      PROCEDURE man_emp AS
      --just for not confusing names, is the same as t_emp of course
      v_emp_array typ_emp;
      BEGIN
        --call the function and retrieve the whole data set
        v_emp_array := get_emp;
        --now manipulate the data, in this case just write the names to the calling client
        FOR rec IN v_emp_array.FIRST .. v_emp_array.LAST
        loop
          dbms_output.put_line(v_emp_array(rec).ename);
        end loop;
      end man_emp;
    end test_cursor;4. Calling the procedure
    SET serveroutput ON
    exec test_cursor.man_emp;5. And this is the result:
    anonymer Block abgeschlossen
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLERPlease be aware, this is just for demonstration purpose, of course it makes no sense to display the names this way. But how to call a funktion returning arrays with datasets from fetching cursors is shown here.
    Hth
    Joerg

  • Can I declare variables in Reports from SQL Query

    Hi
    I have a Report from SQL Query published as a portlet on a page among other reports. In the query report I am using the fuction WWCTX_API.GET_USER at quite a few places to filter the data returned to the user. Can I assingn the user id to a variable at some level & replace the fuction WWCTX_API.GET_USER with the variable in all the places.
    For eg:
    usr varchar2(25);
    usr:= PORTAL30.WWCTX_API.GET_USER;
    select USER_ID, USER_LVL, BUSINESS_ID, BRANCH_ID from crs_user where user_id=usr;
    can i declare variable and assign the value like the above at any level(Report or Page Level) to the acces the variale in queries.
    Thanks in advance

    I have found that you can't use a * in a dynamic page.
    Try this:
    <ORACLE>
    DECLARE
    usr varchar2(25):=PORTAL30.WWCTX_API.GET_USER;
    BEGIN
    for c in
    (SELECT <column_name> <alias> FROM PORTALWORK.CRS_USER WHERE USER_ID=usr)
    Loop
    htp.p(c.<alias>);
    END;
    </ORACLE>
    You can also add table tags for column formating:
    <table>
    <tr><td>column 1</td></tr><tr><td nowrap>
    <ORACLE>
    DECLARE
    usr varchar2(25):=PORTAL30.WWCTX_API.GET_USER;
    BEGIN
    for c in
    (SELECT <column_name> <alias> FROM PORTALWORK.CRS_USER WHERE USER_ID=usr)
    Loop
    htp.p(c.<alias>);
    END;
    </ORACLE>
    </td></tr></table>
    Martin

Maybe you are looking for

  • Safari won't open after installing Mountain Lion

    I installed Mountain Lion (OS X version 10.8.5) on my iMac but Safari didn't update, and wouldn't open.  I separately downloaded Safari 6.2.2.  Safari still wouldn't open.  In trying to fix it, I apparently deleted needed files.  When I click on the

  • Need help in formatting the report created using SSRS

    I have created an image and used it as the body background. But I want that image to come at right Set bodyRepeat as RepeatY.  Currently its showing as below              I need this blue image at the right most side of the report as below Also I nee

  • Issue with integrating subversion with Jdeveloper 11g (11.1.1.4)

    Hi. I have been trying to set-up subversion in Jdeveloper 11g (11.1.1.4) however i keep on getting a authenication error see below The Url i am using is https://[servername]/svnrepo/department-repo/Projects/Project1 Testing read access for repository

  • Need help Staffing a Portal Project

    Can anyone tell me how many people are needed to staff a sun Portal implementation project. We are estimating 2 fulltime developers for a 6 month duration. The client wants the follwing features: Personalization, Online forums/collaboration, Portlets

  • New version of adobe reader, 11.0.10, produces errors when saving our pdf

    Hi, we notice that the pdf's we're generating in our system are encountering errors with the new adobe 11.0.10 and trying to save them. The system returns an Error 21. After research together with our manufacturer of our pdf-generator we've noticed t