With As subquery block in create view statement or In pl/sql block

Hi All,
Can I use the With as subquery block in create view statement??
or in pl/sql
-Thanks
Edited by: xwo0owx on Mar 31, 2011 11:23 AM
Edited by: xwo0owx on Mar 31, 2011 11:23 AM

Hi, Mike,
Dird wrote:
Then why do I get an error? :s create view mike_test_view as    
with carriers as(
SELECT DISTINCT T0.CARRIER_SHORT_NAME carrier_name,
T1.COMP_ID            carrier_id
FROM CS2_CARRIER T0, USER_FUNCTION_QUALIFIER T2, CS2_COMP_SERV_PROV_PROF T1
WHERE (((T1.SERV_PROV_ID = T2.QUALIFIER_VALUE) AND
((T2.FUNCTION_CODE = 'DOC_CCM') AND
(T2.QUALIFIER_CODE = 'CARRIER_LIST'))) AND
(T1.SERV_PROV_ID = T0.SERV_PROV_ID))
ORDER BY T0.CARRIER_SHORT_NAME)
select *
from carriers c;ORA-00942: table or view does not exist -- carriers
If I run every line but the create (just execute the query) it runs fine. It also works fine in a PL/SQL procedure.SQL*Plus abhors a vacuum.
The default in SQL*Plus is that you can not have a completely blank line (that is, a line containing only white space) in the middle of a SQL statement. (Blank lines are okay in PL/SQL, including SQL statements embedded in PL/SQL.)
If you want some space between the end of the WITH clause and the beginning of the main query (or anywhere else, for that matter), you can put comments there. For example:
      ORDER BY T0.CARRIER_SHORT_NAME)
     select *
       from carriers c;Now that line isn't just whitespace; it has the comment sign, and that's enough for SQL*Plus.
You can allow completely blank lines with the SQL*Plus command:
SET   SQLBLANKLINES  ON

Similar Messages

  • Create View Statement Hangs

    Hello -
    I'm running 10g R2 on AIX. I have view A, view B, and view C. View C look like this:
    select * from view A;
    union all
    select * from view B;
    View A and View B both contains many left outer joins.
    View C will compile when it only references view A or view B (without the union).
    What would cause the create view statement to hang when using the union statement? Also, if I leave out the create view for C, then the following select statements will never complete:
    select * from view A;
    union all
    select * from view B;
    I have determined that something with the union statement is causing this to hang.
    Has anyone ever seen anything like this? Any help is greatly appreciated!
    Thanks,
    Mike

    Thanks all for the postings. Sorry it took me so long to get back to this. I am posting the actual ddl for the views. The TESTA and TESTB views are created without any problems. The TESTC view (with the union all) just hangs when trying to create. It's not the view, but the select with the union all. If I run the sql without the create view statement, it still hangs. If I remove the union, and just select from TESTA or only TESTB, then it works fine. I have never seen anything like this. Any help is greatly appreciated! Thx!
    *****************create TESTA****************************************************
    CREATE OR REPLACE VIEW TESTA AS
    SELECT
    addr.addressline1 AS address1,
    addr.addressline2 AS address2,
    addr.addressline3 AS city,
    addr.addressline4 AS state,
    addr.addressline5 AS zipcode
    FROM fapplication app
    INNER JOIN findividual ind
    ON ind.fapplicationid = app.fapplicationid
    LEFT OUTER JOIN fcreditrequest cr
    ON app.fapplicationid = cr.fapplicationid
    LEFT OUTER JOIN faddress addr
    ON ind.findividualid = addr.findividualid
    LEFT OUTER JOIN fvrmaxdealstructure ds
    ON cr.fcreditrequestid = ds.fcreditrequestid
    LEFT OUTER JOIN fvsystemcollectionentry sce1
    ON ds.productratetypeid = sce1.fsystemcollectionentryid
    LEFT OUTER JOIN fvsystemcollectionentry sce2
    ON cr.loanpurposeid = sce2.fsystemcollectionentryid
    AND sce2.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid)
    LEFT OUTER JOIN fvsystemcollectionentry sce3
    ON ds.productpymtfreqid = sce3.fsystemcollectionentryid
    AND sce3.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid, sce3.flanguageid)
    LEFT OUTER JOIN fvsystemcollectionentry sce4
    ON ds.productsecuritytypeid = sce4.fsystemcollectionentryid
    AND sce4.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid, sce3.flanguageid, sce4.flanguageid)
    LEFT OUTER JOIN fvproductcategory prodcat
    ON ds.fproductcategoryid = prodcat.fproductcategoryid
    AND prodcat.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid, sce3.flanguageid, prodcat.flanguageid)
    LEFT OUTER JOIN fvproduct prod
    ON ds.fproductid = prod.fproductid
    AND prod.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid, sce3.flanguageid, prodcat.flanguageid, prod.flanguageid)
    LEFT OUTER JOIN fvrcommonfields udapp1
    ON app.fapplicationid = udapp1.applicationid
    LEFT OUTER JOIN fvrloanauthfields1 udapp2
    ON app.fapplicationid = udapp2.applicationid
    LEFT OUTER JOIN fvrloanauthfields2 udapp3
    ON app.fapplicationid = udapp3.applicationid
    LEFT OUTER JOIN fvrloanauthfields3 udapp4
    ON app.fapplicationid = udapp4.applicationid
    LEFT OUTER JOIN fvrloanauthfields4 udapp5
    ON app.fapplicationid = udapp5.applicationid
    LEFT OUTER JOIN fvrmemofields udapp6
    ON app.fapplicationid = udapp6.applicationid
    WHERE COALESCE(sce1.languagecd, sce2.languagecd, sce3.languagecd, sce4.languagecd, prodcat.languagecd, prod.languagecd, 'EN') = 'EN'
    *****************create TESTB****************************************************
    CREATE OR REPLACE VIEW TESTB AS
    SELECT
    addr.addressline1 AS address1,
    addr.addressline2 AS address2,
    addr.addressline3 AS city,
    addr.addressline4 AS state,
    addr.addressline5 AS zipcode
    FROM fapplication app
    INNER JOIN findividual ind
    ON ind.fapplicationid = app.fapplicationid
    LEFT OUTER JOIN fcreditrequest cr
    ON app.fapplicationid = cr.fapplicationid
    LEFT OUTER JOIN faddress addr
    ON ind.findividualid = addr.findividualid
    LEFT OUTER JOIN fvrmaxdealstructure ds
    ON cr.fcreditrequestid = ds.fcreditrequestid
    LEFT OUTER JOIN fvsystemcollectionentry sce1
    ON ds.productratetypeid = sce1.fsystemcollectionentryid
    LEFT OUTER JOIN fvsystemcollectionentry sce2
    ON cr.loanpurposeid = sce2.fsystemcollectionentryid
    AND sce2.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid)
    LEFT OUTER JOIN fvsystemcollectionentry sce3
    ON ds.productpymtfreqid = sce3.fsystemcollectionentryid
    AND sce3.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid, sce3.flanguageid)
    LEFT OUTER JOIN fvsystemcollectionentry sce4
    ON ds.productsecuritytypeid = sce4.fsystemcollectionentryid
    AND sce4.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid, sce3.flanguageid, sce4.flanguageid)
    LEFT OUTER JOIN fvproductcategory prodcat
    ON ds.fproductcategoryid = prodcat.fproductcategoryid
    AND prodcat.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid, sce3.flanguageid, prodcat.flanguageid)
    LEFT OUTER JOIN fvproduct prod
    ON ds.fproductid = prod.fproductid
    AND prod.flanguageid = COALESCE (sce1.flanguageid, sce2.flanguageid, sce3.flanguageid, prodcat.flanguageid, prod.flanguageid)
    LEFT OUTER JOIN fvrcommonfields udapp1
    ON app.fapplicationid = udapp1.applicationid
    LEFT OUTER JOIN fvrloanauthfields1 udapp2
    ON app.fapplicationid = udapp2.applicationid
    LEFT OUTER JOIN fvrloanauthfields2 udapp3
    ON app.fapplicationid = udapp3.applicationid
    LEFT OUTER JOIN fvrloanauthfields3 udapp4
    ON app.fapplicationid = udapp4.applicationid
    LEFT OUTER JOIN fvrloanauthfields4 udapp5
    ON app.fapplicationid = udapp5.applicationid
    LEFT OUTER JOIN fvrmemofields udapp6
    ON app.fapplicationid = udapp6.applicationid
    WHERE COALESCE(sce1.languagecd, sce2.languagecd, sce3.languagecd, sce4.languagecd, prodcat.languagecd, prod.languagecd, 'EN') = 'EN'
    *****************create TESTC****************************************************
    CREATE OR REPLACE VIEW TESTC AS
    SELECT
         TESTA.ADDRESS1,
    TESTA.ADDRESS2,
    TESTA.CITY,
    TESTA.STATE,
    TESTA.ZIPCODE
    FROM TESTA
    UNION ALL
    SELECT
    TESTB.ADDRESS1,
    TESTB.ADDRESS2,
    TESTB.CITY,
    TESTB.STATE,
    TESTB.ZIPCODE
    FROM TESTB;

  • How to use the WHENEVER SQLERROR EXIT statement in a PL/SQL block.

    Hi,
    I am getting the following error when trying to add the following statement in an PL/SQL block.
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    [exec] ERROR at line 23:
    [exec] ORA-06550: line 23, column 12:
    [exec] PLS-00103: Encountered the symbol "SQLERROR" when expecting one of the
    [exec] following:
    [exec] := . ( @ % ;
    How can i use the above statement in the PL/SQL Block? I have only IF statement in that block( between BEGIN and END).
    Thanks

    Hi,
    Usually there's always more than one solution.
    Can you post an example of what you're trying to accomplish?
    That would be useful.
    (Place the tag before and after your example to maintain formatting en spacing, see the [fac|http://forums.oracle.com/forums/help.jspa] regarding available tags)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Query on getting the Pane with all the items for creating Views

    Hi Group,
    I have a query as under:
    I was trying to create a sample Web Dynpro ( for ABAP ) using tcode SE80 and while creating view, I have to get the Pane with the items ( eg., Radio element, text fields, text areas, etc., kind of all UI Elements )....
    But, I was not able to get while defining the View for the Web Dynpro application....
    Please let me know if any setting has to be done to get this or any other clue as to get this Pane...
    Thanks in advance.
    Regards,
    Vishnu.

    hi vishnu....
            make sure you have given the host and port in the local host file in c:/.
    [link|help.sap.com/saphelp_erp2005/helpdata/en/43/e86de5008b4d9ae10000000a155369/content.htm ].
    ---regards,
       alex b justin

  • Can't create a sequence within a pl/sql block with execute immediate.

    Hi All. I created a user and granted it the 'create sequence' privilege though a role. In a pl/sql block I try to create a sequence using 'execute immediate' but get a 1031-insufficient privileges error. If I grant create sequence directly to the user, the pl/sql block completes successfully. Can anyone explain this behavior? We're running 11.2 Enterprise Editon.
    Thanks,
    Mark

    In a definer's rights stored procedure (the default), you only have access to privileges that have been granted directly, not via a role.
    There are two basic reasons for that. First, roles can be enabled or disabled, default and non-default, password-protected, etc. so the set of roles a particular user actually has is session-specific. Oracle needs to know at compile time what privileges the owner of the procedure has. The only way to do that (without deferring the privilege check) is to ignore privileges granted through roles.
    Second, since 99% of privilege management DBAs do involves granting and revoking roles, it's helpful that changing role privileges will never cause objects to be marked invalid and recompiled which can have side-effects on applications. DBAs only need to worry about causing problems on those rare cases where they are granting or revoking direct privileges to users.
    You can create an invoker's rights stored procedure by adding the clause (AUTHID CURRENT_USER). That defer's the security check to run-time but allows the procedure to see privileges granted through roles in the current session. But that means that the caller of the procedure would need to have the CREATE SEQUENCE privilege through the role, not the owner of the procedure.
    And just to make the point, dynamic object creation in PL/SQL is almost always a red flag that there is something problematic in your design. If you are creating sequences dynamically, that means that you'd have to refer to them dynamically throughout your code which means that your inserts would need to use dynamic SQL. That's not a particularly easy or safe way to develop code.
    Justin

  • Alter database statement in anonymous pl/sql block

    Is it possible to include an alter database statement in an anonymous pl/sql block?
    When I execute this code to query user_tables for all table names, disable their constraints and drop the table, I got the following error:
    ***MY CODE
    -- DECLARE VARIABLE(S)
    DECLARE
         v_TABLE_NAME TABLE_NAME.USER_TABLE%TYPE;
    -- DECLARE AND DEFINE CURSOR
    CURSOR c_GETTABLES is
         SELECT TABLE_NAME from USER_TABLES;
    BEGIN
    OPEN c_GETTABLES;
    LOOP
    FETCH c_GETTABLES into v_TABLE_NAME;
    EXIT when c_GETTABLES%notfound;     
    ALTER TABLE v_TABLE_NAME DISABLE PRIMARY KEY CASCADE;
    DROP TABLE v_TABLE_NAME;
    END LOOP;
    CLOSE c_GETTABLES;
    END;
    ***RESPONSE FROM SERVER
    ALTER TABLE v_TABLE_NAME DISABLE PRIMARY KEY CASCADE;
    ERROR at line 15:
    ORA-06550: line 15, column 1:
    PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
    begin case declare exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge
    <a single-quoted SQL string> pipe
    Thanks

    When you want to perform ddl statements in a (anonymous) PL/SQL block, you have to use dynamic SQL because ddl is not possible in pl/sql.
    Dynamic sql means that you sort of execute ddl statements in a sql manner. To use dynamic sql, two options exist:
    - dbms_sql package : for oracle before 8i. To use this package is not always easy. Read about it carefully first before using.
    - Native Dynamic SQL : implemented in 8i and very easy to use. An example would be :
    declare
    lv_statement varchar2(32676);
    begin
    lv_statement := 'ALTER TABLE MY_TABLE DISABLE CONSTRAINT MY_TABLE_CK1';
    execute immediate lv_statement;
    lv_statement := 'ALTER TABLE MY_TABLE ENABLE CONSTRAINT MY_TABLE_CK1';
    execute immediate lv_statement;
    end;
    Good luck.
    Edwin van Hattem

  • Need to refresh materialized view from procedure and pl/sql block

    Hi,
    I need to refresh materialized view (complete refresh)from procedure and pl/sql block .can some one help.
    MV name:MV_DGN_TEST_SESSION
    Thanks,
    Rajasekhar

    dbms_mview.REFRESH ('MV_DGN_TEST_SESSION', 'C');Regards,
    Mahesh Kaila
    Edited by: user4211491 on Dec 1, 2009 10:41 PM

  • Update statement not working PL/SQL block

    Hi friends,
    My code is written the following way:
    declare
    var1 number;
    var2....
    Cursor c1 <select something>;
    Cursor c2 <select something>
    Begin
    Insert into table1 <different values>;
    Commit;
    /* first update statement */
    Update table1 set table1.col3 = (select col3 from table2 where table2.col1 = table1.col1 and table2.col2 = table1.col2);
    commit ;
    /* 2nd update statement */
    update table1 set table1.col4 = (select col4 from table3 where table3.col1 = table1.col1 and table3.col2 = table1.col2);
    commit ;
    for r2 in c2 loop
    update table1
    end loop;
    end;
    This code works till 1st update statement. But after that, even if I let my code run overnight, nothing happens. There are appropriate indexes on tables where join is done. All tables are in one schema.
    What could be the reason?

    darshilm wrote:
    /* first update statement */
    Update table1 set table1.col3 = (select col3 from table2 where table2.col1 = table1.col1 and table2.col2 = table1.col2);This is an unconstrained updated - meaning that it instructs the database that every single row in TABLE1 needs to be updated.
    For every single row, the "update" SQL has to be executed and a SELECT performed on TABLE2.
    Let's say there are a 100,000 rows in TABLE1. This means that the SELECT to find the updated value has to be executed a 100,000 times.
    Let's say that there are a 200,000 rows in TABLE2. This means that each time that SELECT runs, it potentially hits 200,000 rows. Does it do it via a full table scan? Index range scan?
    At what cost? Hitting the very same data set again and again and again, 100,000 times in a row.
    And that is only the start of your code... and you wonder why it does not seem to finish?
    Data processing in a RDBMS is about how to do the minimal amount of I/O to achieve the desired result. For example, instead of hitting TABLE2 100,000 times, you can write code to hit it once by joining it with TABLE1 and creating an "updateable view" of TABLE1 that can be updated with the join values of TABLE2.
    You also seem to use PL/SQL cursors to perform row-row (and slow-by-slow) processing. This typically pulls data from the SQL engine into the PL engine and then push that very same data from the PL engine to the SQL engine.. It is a lot faster and more efficient (and scalable) to rather stay inside the SQL engine and do data set processing there (as oppose to row-by-row on the client side).
    Performance in a RDBMS is primarily determined by the designer and the developer... are functions of how well designed the data model is, and how well designed and written the code is.

  • Create table statement in a pl/sql procedure

    Hi all.
    I have a problem in Oracle 10g.
    First of all I must say that I'm new in oracle 10.
    I have a stored procedure in which I have the instruction "create table name_table as
    select col1,col2,col3,..ecc
    from table1, table2
    where table1.col1 = table2.col2"
    When I compile this procedure it gives me an error.
    Is it changed the sintax????
    Is there anyone that can help me???
    Thanks all for the collaboration,
    Fabrizio

    A little mistake -- see it --
    SQL> ed
    Wrote file afiedt.buf
      1  Create or replace procedure My_procedure as
      2  begin
      3  EXECUTE IMMEDIATE 'create table my_table(fld number(5));'
      4* end;
    SQL> /
    Warning: Procedure created with compilation errors.
    SQL>
    SQL>
    SQL> ed
    Wrote file afiedt.buf
      1  Create or replace procedure My_procedure as
      2    str varchar2(200);
      3  begin
      4   str := 'create table my_table(fld number(5))';
      5  EXECUTE IMMEDIATE(str);
      6* end;
    SQL> /
    Procedure created.
    SQL>
    SQL>
    SQL> Create or replace procedure My_procedure as
      2  begin
      3  EXECUTE IMMEDIATE 'create table my_table(fld number(5));'
      4  end;
      5  /
    Warning: Procedure created with compilation errors.
    SQL> ed
    Wrote file afiedt.buf
      1  Create or replace procedure My_procedure as
      2  begin
      3  EXECUTE IMMEDIATE 'create table my_table(fld number(5))';
      4* end;
    SQL> /
    Procedure created.Regards.
    Satyaki De.
    N.B.: Please check the bolded line. You didn't write the ; outside the quotation. Otherwise, it will compile successfully.

  • Want to create Ineractive report by using pl/sql block

    Hi,
    But If have to read different informations for different tables, how can I do ?
    For example:
    for s in (SELECT srv_sys_name,ddb_dbname
    FROM search_master
    WHERE ( ddb_dbname like '%'||:p7_ddb_dbname||'%' AND :p7_ddb_dbname IS NOT NULL ))
    loop
    apex_collection.add_member(p7_col, s.srv_sys_name, s.ddb_dbname );
    end loop;
    If I have an other table to look to get other informations, i don't know what to do ?
    It's my problem for now.
    Thanks in advance. Bye.

    HTML_DB 1.6 + Apex 4.0 + Hyperion user wrote:
    But If have to read different informations for different tables, how can I do ?
    For example:
    for s in (SELECT srv_sys_name,ddb_dbname
    FROM search_master
    WHERE ( ddb_dbname like '%'||:p7_ddb_dbname||'%' AND :p7_ddb_dbname IS NOT NULL ))
    loop
    apex_collection.add_member(p7_col, s.srv_sys_name, s.ddb_dbname );
    end loop;If I have an other table to look to get other informations, i don't know what to do ?Generally, perform a join combining the tables.
    Additionally, creating collections row-by-row is horribly inefficient. Use the <tt>APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B</tt> bulk methods instead.
    However in this case the the PL/SQL and collection-based approach is unnecessary. Base the IR on the query (plus joins to whatever other tables are necessary):
    select srv_sys_name,ddb_dbname
    from search_master
    where ddb_dbname like :p7_ddb_dbname_qryand compute hidden item <tt>p7_ddb_dbname_qry</tt> to include the value of <tt>p7_ddb_dbname</tt> and wildcard characters as required.
    Finally, note that <tt>LIKE</tt> searches using leading-edge wildcards on large data sets can be inefficient as this eliminates the possibility of using indexes on the searched column.
    (Always post code wrapped in tags<tt>\...\</tt> tags to preserve formatting and special characters.)

  • CREATE VIEW with PreparedStatement

    Hi guys,
    I'm trying to run a CREATE VIEW statement, which I have been doing up till now just using a regular Statement, and using the executeUpdate() method. It's been working fine for a while, and now i've hit a bit of a problem.
    I can't include a WHERE clause in a Statement, as it doesn't like the single quotations (') and wildcards. After searching this forum, I saw that I should be using a PreparedStatement, and using the setString() method to put in the ' and %'s.
    Now when I try to run the PreparedStatement using the executeUpdate() method, I get the "Incorrect syntax near the keyword 'VIEW'" error. Can anyone tell me if i'm using the right method for executing the PreparedStatement, or what i'm doing wrong?
    Regards,
    Jack Smith

    SQL statements are often broken up into two classes, DML (data manipulation language) and DDL (data definition language). DML contains the normal CRUD statements, INSERT, SELECT, UPDATE, DELETE and anything else that modifes the data but not the data structure. DDL is the set of statements that manipulates the data structure, things like CREATE, ALTER, DROP.
    As a general rule of thumb, you shouldn't do DDL in a PreparedStatement.
    PreparedStatements exist primarily to allow late-binding of data-value objects into the internal datastructure within the database that represents a parsed SQL statement's execution plan. It is NOT a mechanism for doing string substitution (though I understand who it can look that way to beginners).
    Another way of saying this is that PreparedStatement is based on the distinction between data and code; in a DDL statement, the entire statement is code.
    There are a few drivers/databases where this might happen to work, because they aren't really seriously implementing PreparedStatement but merely doing string replacement to fake it. I very much doubt SQL server is going to be one of these.

  • Problem with multiple client numbers from a view

    Hi Gurus,
    I have a problem with a view
    Creates a view with a UNION ALL stmt
    =====================================
    Create view vw_benifits
    as
    SELECT
         Client_num, -- can have multiple values like 200,201,250
         PERNR,     
         OBJPS,     
         ENDDA,     
         BEGDA,
         AEDTM,     
         UNAME,
         COB_MNTH_AMT
    FROM
         STG_SAP_PA9211_TB
    UNION ALL
    SELECT
         null, -- no client number for legacy data
         PERNR,     
         OBJPS,     
         ENDDA,     
         BEGDA,
         AEDTM,     
         UNAME,
    COB_MNTH_AMT
    from
         LEG_STG_SAP_PA9211_TB;
    ==============================
    The second table contains legacy data (LEG_STG_SAP_PA9211_TB). The first table now contains multiple client data (ie the client_num can be 201,202,250 like that.
    Now if the users qery the view they will only get that clients data.
    eg selet * from vw_benifits where client_num=250 results only client 250 data. But I want to add the legacy data also with that.
    I don't want to propose
    selet * from vw_benifits where client_num in (250,NULL) since the users will be confused.
    Is there any other way to do this . my requirement is like
    If they query
    select * from vw_benifits where client_num=250, the data should include all the records satisfying client=250 + the records from the legacy data. The view need to be created like that.
    Appreciate your help
    Deepak

    Hi Thanks for the suggestion.
    But I am not sure this may work for me. Here my users may not be able to use that since they don't know Oracle.
    I want to hide that details from them
    They may just issue a statement like this
    select * from vw_benifits where client_num =250
    Or
    select * from vw_benifits where client_num =400 . But both times I need to show them the data from the legacy table.
    Deepak

  • Cell Offload will Happen for pl/sql Block with variables

    Hello Experts,
    i am working on procedures on exadata now. i was confused with cell offload in exadata. somehow offload is not happening when i ran the sql statement in in pl/sql block with variables.
    here are my findings.
    when i ran insert into from select with values at toad, my query response time is very good. the total process is completed in less than a minute.
    i checked offload is happening.
    same sql statement is placed in plsql block with variable, procedure is taking lot of time and it is not completing. this case offload is not happening.
    is it true, if i use variables in pl/sql block will not use cell offload and smart scan?
    if yes, what is the work around.
    Thanks
    #! Pavan

    Hello Marc,
    Thanks for quick response.
    when i ran the query with literals in toad session i am getting response.
    when i run it with pl/sql block , block is not completing at all.
    here is the plsql block:
    My Apologies for sending big code,with out proper format.
    DECLARE
    P_BUSINESS_DATE DATE;
    P_BATCH_ID NUMBER;
    UTC_OFFSET NUMBER;
    BEGIN
    P_BUSINESS_DATE := to_date('02/01/2012', 'MM/DD/YYYY');
    P_BATCH_ID := 1;
    UTC_OFFSET := 0;
    INSERT /*+ APPEND */ INTO UPL_CLIENT_tbl
    ( reportdate,
    LastName,
    FirstName,
    MiddleInitial,
    AccountNumber,
    Address,
    City,
    State,
    Zip,
    HomePhone,
    WorkPhone,
    BirthDate,
    Age,
    Sex,
    NumberOfChildren,
    Occupation,
    LeadSource,
    Consultant,
    ProgramDirector,
    CallTaker,
    LeadDate,
    FirstVisitDate,
    LastVisitDate,
    BillType,
    ClientType,
    PreviousClientType,
    AppointmentDate,
    DoctorLetterRequired,
    OneYearPermStabilizationDate,
    UnlimitedPermStabilizationDate,
    MaritalStatus,
    ReferrerName,
    ReferrerCentreID,
    CentreID,
    PaymentDateOne,
    PaymentAmountOne,
    PaymentDateTwo,
    PaymentAmountTwo,
    PaymentDateThree,
    PaymentAmountThree,
    PaymentDateFour,
    PaymentAmountFour,
    LibraryPurchased,
    BalanceDue,
    FoodNSFBalance,
    ProductNSFBalance,
    ProgramNSFBalance,
    StartWeight,
    CurrentWeight,
    GoalWeight,
    Height,
    DateGoalWeightAchieved,
    DateSuccessPlusPurchased,
    ReturnToActiveDate,
    VersionNumber,
    HalfWayDate,
    LastLSCDate,
    LastUpdatedDate,
    VitaminWaiverSigned,
    LastSupplementPurchaseDate,
    LastSupplementCodePurchased,
    LastTotalSupplementSupplyCycle,
    LastAddtlSupplPurchaseDate,
    LastAddtlSupplCodePurchased,
    LastAddtlSupplSupplyCycle,
    DiabetesClient,
    DietControlled,
    TakingOralMed,
    TakingInsulin,
    EmailId,
    CTADate,
    RWLDate,
    Address2)
    (SELECT /*+ full(S_CONTACT) full(REFERRER) full(Consultant) full(ProgramDirector) full(CallTaker) full(S_CONTACT_X) full(a) full(a2) full (a3) */ distinct p_business_date reportdate,
    SUBSTR(S_CONTACT.LAST_NAME,1,25) AS LastName,
    SUBSTR(S_CONTACT.FST_NAME,1,25) AS FirstName,
    SUBSTR(S_CONTACT.MID_NAME,1,1) AS MiddleInitial,
    S_CONTACT.X_JC_ACNT_NUM + 900000000 AS AccountNumber,
    SUBSTR(S_ADDR_PER.ADDR,1,40) AS ADDRESS,
    SUBSTR(S_ADDR_PER.CITY,1,20) AS City,
    S_ADDR_PER.STATE AS State,
    SUBSTR(S_ADDR_PER.ZIPCODE,1,15) AS Zip,
    SUBSTR(REPLACE(S_CONTACT.HOME_PH_NUM,'-',''),1,10) AS HomePhone,
    SUBSTR(REPLACE(S_CONTACT.WORK_PH_NUM,'-',''),1,10) AS WorkPhone,
    S_CONTACT.BIRTH_DT AS BirthDate,
    CASE WHEN FLOOR((p_business_date - S_CONTACT.BIRTH_DT)/360) < 0 THEN NULL ELSE FLOOR((p_business_date - S_CONTACT.BIRTH_DT)/360) END AS AGE,
    S_CONTACT.SEX_MF AS SEX,
    NULL AS NumberOfChildren,
    S_CONTACT_X.ATTRIB_34 AS OCCUPATION,
    CASE WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Othe' THEN 'Othr'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Inte' THEN 'Intr'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Prin' THEN 'News'
    WHEN SUBSTR(S_CONTACT_X.ATTRIB_37,1,4)='Gues' THEN 'Gst'
    ELSE SUBSTR(S_CONTACT_X.ATTRIB_37,1,4) END AS LeadSource,
    SUBSTR(Consultant.EMP_NUM,1,10) AS CONSULTANT,
    ProgramDirector.EMP_NUM AS ProgramDirector,
    CallTaker.EMP_NUM CallTaker,
    S_CONTACT.X_LEAD_DT AS LeadDate,
    LEAST(nvl(S_CONTACT.X_LAST_CONSULTATION_DATE,O.FirstPurchaseDate ), nvl(O.FirstPurchaseDate,S_CONTACT.X_LAST_CONSULTATION_DATE+1) ) AS FirstVisitDate, --X_LAST_CONSULTATION_DATE stores the performed date or the legacy client firstvisitdate
    GREATEST(nvl(S_CONTACT_XM.X_CONSULTATION_DT ,S_CONTACT_X.ATTRIB_29), nvl(S_CONTACT_X.ATTRIB_29, S_CONTACT_XM.X_CONSULTATION_DT-1) ) AS LastVisitDate,
    CASE WHEN S_CONTACT.X_INSTALLMENT_BALANCE > 0 THEN 'B' ELSE NULL END AS BillType,
    ct.current_client_type ClientType,
    SUBSTR(ct.saved_client_type,1,1) PreviousClientType,
    S_CONTACT.LAST_CREDIT_DT AS AppointmentDate,
    CASE WHEN a.X_DR_LETTER_STATUS IS NOT NULL THEN 'Y' ELSE 'N' END AS DoctorLetterRequired,
    NULL AS OneYearPermStabilizationDate,
    DECODE(S_PROD_INT.X_PROGRAM_CLASSIFICATION,'Premium',a.START_DT ,NULL) AS UnlimitedPermStabilizationDate,
    SUBSTR(S_CONTACT.MARITAL_STAT_CD,1,1) AS MaritalStatus,
    SUBSTR(REFERRER.FST_NAME ||' '|| REFERRER.LAST_NAME,1,34) AS ReferrerName,
    ORGEXT_REF.LOC AS ReferrerCentreID,
    S_ORG_EXT.LOC AS CentreID,
    NULL AS PaymentDateOne,
    NULL AS PaymentAmountOne,
    NULL AS PaymentDateTwo,
    NULL AS PaymentAmountTwo,
    NULL AS PaymentDateThree,
    NULL AS PaymentAmountThree,
    NULL AS PaymentDateFour,
    NULL AS PaymentAmountFour,
    NULL AS LibraryPurchased,
    nvl(S_CONTACT.X_INSTALLMENT_BALANCE,0) + nvl(S_CONTACT.X_PREPAID_BALANCE,0) AS BalanceDue, -- Changed operation from (-) prepaid to (+) prepaid since the sign was flipped in OLTP.
    NULL AS FoodNSFBalance,
    NULL AS ProductNSFBalance,
    NULL AS ProgramNSFBalance,
    a2.X_START_WEIGHT AS StartWeight,
    a2.X_CURRENT_WEIGHT AS CurrentWeight,
    a2.X_GOAL_WEIGHT AS GoalWeight,
    a3.X_HEIGHT AS Height,
    a2.X_FAXSENT_DATETIME DateGoalWeightAchieved,
    DECODE(S_PROD_INT.X_PROGRAM_CLASSIFICATION,'Premium',a.START_DT,NULL) AS DateSuccessPlusPurchased,
    CASE WHEN A2.ARCHIVE_FLG = 'N' THEN a2.START_DT ELSE NULL END AS ReturnToActiveDate,
    600 VersionNumber,
    a2.X_FAXRECV_DATETIME AS HalfWayDate,
    NULL AS LastLSCDate,
    TRUNC(S_CONTACT.LAST_UPD-UTC_OFFSET/24) AS LastUpdatedDate,
    NULL AS VitaminWaiverSigned,
    LastSupplementPurchaseDate,
    LastSupplementCodePurchased,
    LastTotalSupplementSupplyCycle,
    LastAddtlSupplPurchaseDate,
    LastAddtlSupplCodePurchased,
    LastAddtlSupplSupplyCycle,
    CASE WHEN (a.X_DIABETES_NO_MEDS_FLG='Y' OR a.X_DIABETES_ORAL_MEDS_FLG = 'Y' OR a.X_DIABETES_ON_INSULIN_FLG = 'Y') THEN 'Y' ELSE 'N' END AS DiabetesClient,
    DECODE(a.X_DIABETES_NO_MEDS_FLG,'Y','Y','N') AS DietControlled,
    a.X_DIABETES_ORAL_MEDS_FLG AS TakingOralMed,
    a.X_DIABETES_ON_INSULIN_FLG AS TakingInsulin,
    S_CONTACT.EMAIL_ADDR AS EmailId,
    NULL CTADATE,
    NULL RWLDATE,
    SUBSTR(S_ADDR_PER.ADDR_LINE_2,1,40) AS Address2
    FROM S_CONTACT,
    S_CONTACT REFERRER,
    S_CONTACT Consultant,
    S_CONTACT ProgramDirector,
    S_CONTACT CallTaker,
    S_CONTACT_X,
    (SELECT /*+ parallel full(S_CONTACT_XM) */ PAR_ROW_ID, attrib_05, MAX(X_CONSULTATION_DT) AS X_CONSULTATION_DT FROM S_CONTACT_XM
    WHERE (S_CONTACT_XM.last_upd_by < '1-14WD'
    or S_CONTACT_XM.last_upd_by > '1-14WD')
    AND S_CONTACT_XM.ATTRIB_05 IN (SELECT row_id FROM S_ORG_EXT WHERE S_ORG_EXT.ACCNT_TYPE_CD IN ('Corporate Centre','Franchise Centre')) LOC IN (SELECT centreid FROM UPL_LIVE_CENTRES WHERE LIVE = 'Y' AND BATCHID = p_batch_id)) where S_ORG_EXT.ACCNT_TYPE_CD IN ('Corporate Centre','Franchise Centre')) --
    GROUP BY PAR_ROW_ID, attrib_05) S_CONTACT_XM,
    (SELECT CONTACT_ID, ACCNT_ID,
    MAX(LastSupplementPurchaseDate) AS LastSupplementPurchaseDate,
    MAX(LastSupplementCodePurchased) AS LastSupplementCodePurchased,
    MAX(LastTotalSupplementSupplyCycle) AS LastTotalSupplementSupplyCycle,
    MAX(LastAddtlSupplPurchaseDate) AS LastAddtlSupplPurchaseDate,
    MAX(LastAddtlSupplCodePurchased) AS LastAddtlSupplCodePurchased,
    MAX(LastAddtlSupplSupplyCycle) AS LastAddtlSupplSupplyCycle,
    MIN(FirstPurchaseDate) AS FirstPurchaseDate,
    MAX(LastPurchaseDate) AS LastPurchaseDate
              FROM (
              SELECT /*+ parallel full(S_ORDER) full(S_ORDER_XM) */ S_ORDER.CONTACT_ID AS CONTACT_ID,S_ORDER.ACCNT_ID,
    NULL AS LastSupplementPurchaseDate,
    NULL AS LastSupplementCodePurchased,
    NULL AS LastTotalSupplementSupplyCycle,
    NULL AS LastAddtlSupplPurchaseDate,
    NULL AS LastAddtlSupplCodePurchased,
    NULL AS LastAddtlSupplSupplyCycle,
    (S_ORDER_XM.X_BUSINESS_DATE) FirstPurchaseDate,
    (S_ORDER_XM.X_BUSINESS_DATE) LastPurchaseDate
              FROM S_ORDER,S_ORDER_XM
              WHERE S_ORDER.ROW_ID = S_ORDER_XM.PAR_ROW_ID
              AND S_ORDER.STATUS_CD IN ('Complete', 'Submitted', 'Ready')
              AND TRUNC(S_ORDER_XM.X_BUSINESS_DATE - UTC_OFFSET/24) <= (p_business_date)
              --GROUP BY S_ORDER.CONTACT_ID
              UNION ALL
              SELECT /*+ parallel full(S_ORDER) full (S_ORDER_ITEM) */ S_ORDER.CONTACT_ID AS CONTACT_ID,S_ORDER.ACCNT_ID,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN S_ORDER.CREATED ELSE NULL END) AS LastSupplementPurchaseDate,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN 931 ELSE NULL END) AS LastSupplementCodePurchased,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '931' THEN 7 ELSE NULL END) AS LastTotalSupplementSupplyCycle,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN S_ORDER.CREATED ELSE NULL END) AS LastAddtlSupplPurchaseDate,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN 920 ELSE NULL END) AS LastAddtlSupplCodePurchased,
              (CASE WHEN SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) = '920' THEN 28 ELSE NULL END) AS LastAddtlSupplSupplyCycle,
              NULL FirstPurchaseDate,
              NULL LastPurchaseDate
              FROM S_ORDER,S_ORDER_ITEM, S_PROD_INT
              WHERE S_ORDER_ITEM.PROD_ID = S_PROD_INT.ROW_ID
                   AND S_ORDER.ROW_ID = S_ORDER_ITEM.ORDER_ID
                   AND S_ORDER_ITEM.qty_req <> 0
                   AND s_order.created_by <> '1-14WD'
                   AND S_ORDER_ITEM.PAR_ORDER_ITEM_ID is null
                   AND (S_ORDER_ITEM.PAR_ORDER_ITEM_ID is null
                   OR EXISTS (select 1 from S_ORDER_ITEM i2,s_prod_int p
    where i2.row_id = S_ORDER_ITEM.PAR_ORDER_ITEM_ID
    and SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) IN ('931','920')
    and i2.prod_id = p.row_id
                   AND S_ORDER.status_cd in ('Complete', 'Submitted', 'Ready')
                   and SUBSTR(SUBSTR(S_PROD_INT.PART_NUM,1,INSTR(S_PROD_INT.PART_NUM,'-',1,1)-1),2,4) IN ('931','920')
    GROUP BY CONTACT_ID,ACCNT_ID) O,
    S_CONTACT_TNTX,
    S_ORG_EXT,
    S_ORG_EXT ORGEXT_REF,
    S_ADDR_PER,
    S_ASSET a,
    S_PROD_INT,
    S_ASSET a2,
    S_ASSET a3,
    UPL_CLIENT_TYPES ct,
    (select /*+ parallel */ o.contact_id, o.accnt_id
    from S_ORDER o, S_ORDER_XM oxm
    where o.row_id = oxm.par_row_id
    and trunc(oxm.X_BUSINESS_DATE - (UTC_OFFSET/24)) = trunc(p_business_date)
    group by o.contact_id, o.accnt_id) oxm2
    WHERE S_CONTACT.ROW_ID = S_CONTACT_X.PAR_ROW_ID
    AND S_CONTACT_X.ROW_ID = S_CONTACT_XM.PAR_ROW_ID (+)
    AND (S_ORG_EXT.ROW_ID = S_CONTACT.PR_DEPT_OU_ID
    OR S_ORG_EXT.ROW_ID = oxm2.accnt_id
    OR S_ORG_EXT.ROW_ID = S_CONTACT_XM.attrib_05)
    AND ORGEXT_REF.ROW_ID(+) = REFERRER.PR_DEPT_OU_ID
    AND S_CONTACT.CON_ASST_PER_ID = Consultant.ROW_ID
    AND S_ORG_EXT.X_DIRECTOR_ID = ProgramDirector.ROW_ID (+)
    AND S_CONTACT.CREATED_BY = CallTaker.ROW_ID
    AND S_CONTACT.ROW_ID = a.PR_CON_ID (+)
    AND S_CONTACT.PR_PER_ADDR_ID = S_ADDR_PER.ROW_ID (+)
    AND S_CONTACT_TNTX.PAR_ROW_ID (+) = S_CONTACT.ROW_ID
    AND REFERRER.ROW_ID(+) = S_CONTACT_TNTX.REFERRED_BY_ID
    AND a.PROD_ID = S_PROD_INT.ROW_ID (+)
    AND O.CONTACT_ID (+) = S_CONTACT.ROW_ID
    AND a.STATUS_CD (+) = 'Active'
    AND a.TYPE_CD (+) ='Program'
    AND S_CONTACT.ROW_ID = a2.PR_CON_ID (+)
    AND a2.STATUS_CD (+) = 'Active'
    AND a2.TYPE_CD (+) = 'Lifecycle'
    AND a3.PR_CON_ID(+) = S_CONTACT.ROW_ID
    AND a3.STATUS_CD (+) = 'Active'
    AND a3.TYPE_CD (+) = 'HealthSheet'
    AND S_CONTACT.X_JC_ACNT_NUM = ct.CLIENT_NUMBER (+)
    --AND S_ORG_EXT.LOC NOT LIKE 'F%'
    AND S_ORG_EXT.ACCNT_TYPE_CD NOT IN 'Division'
    --AND S_ORG_EXT.Loc in (select to_char(centreid) from UPL_LIVE_CENTRES where LIVE = 'Y')
    AND (trunc(S_CONTACT.LAST_UPD - (UTC_OFFSET/24)) = trunc(p_business_date) or trunc(S_CONTACT_X.LAST_UPD - (UTC_OFFSET/24)) = trunc(p_business_date) OR (S_CONTACT_XM.X_CONSULTATION_DT = p_business_date) OR oxm2.CONTACT_ID IS NOT NULL)
    AND S_CONTACT.last_upd_by not in ('1-14WD')
    AND oxm2.CONTACT_ID (+) = o.CONTACT_ID
    AND S_ORG_EXT.LOC <> 'CW_846'
    AND (a.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a.pr_accnt_id is null)
    AND (a2.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a2.pr_accnt_id is null)
    AND (a3.pr_accnt_id in (select row_id from S_ORG_EXT where S_ORG_EXT.LOC IN (Select CentreID from UPL_Live_Centres where BATCHID = p_batch_id)) or a3.pr_accnt_id is null));
    rollback;
    END;
    --------------------------------------------------------------------------------------------------

  • Doubt in Create View Syntax

    Hi All,
    I want to know the logic behind the following create view statement. Primarily I want to know about the significance of "with" statement in the following command.
    CREATE OR REPLACE FORCE VIEW ODS_DEV.RPT_BU_GEN_REV_V_2
    (HRCHY_ID, FRE_ID, S_BU_ID, BU_ID, EFF_FROM_DT,
    EFF_TO_DT, ACTIVE_FLG, HRCHY_NM_LONG, HRCHY_LVL_NB, S_LVL1,
    LVL1, NM_LONG_1, LOB_CD_1, LVL_NB_1, LVL_NM_1,
    S_LVL2, LVL2, NM_LONG_2, LOB_CD_2, LVL_NB_2,
    LVL_NM_2, S_LVL3, LVL3, NM_LONG_3, LOB_CD_3,
    LVL_NB_3, LVL_NM_3, S_LVL4, LVL4, NM_LONG_4,
    LOB_CD_4, LVL_NB_4, LVL_NM_4, S_LVL5, LVL5,
    NM_LONG_5, LOB_CD_5, LVL_NB_5, LVL_NM_5, S_LVL6,
    LVL6, NM_LONG_6, LOB_CD_6, LVL_NB_6, LVL_NM_6,
    S_LVL7, LVL7, NM_LONG_7, LOB_CD_7, LVL_NB_7,
    LVL_NM_7, S_LVL8, LVL8, NM_LONG_8, LOB_CD_8,
    LVL_NB_8, LVL_NM_8, S_LVL9, LVL9, NM_LONG_9,
    LOB_CD_9, LVL_NB_9, LVL_NM_9, S_LVL10, LVL10,
    NM_LONG_10, LOB_CD_10, LVL_NB_10, LVL_NM_10, S_LVL11,
    LVL11, NM_LONG_11, LOB_CD_11, LVL_NB_11, LVL_NM_11,
    S_LVL12, LVL12, NM_LONG_12, LOB_CD_12, LVL_NB_12,
    LVL_NM_12, S_LVL13, LVL13, NM_LONG_13, LOB_CD_13,
    LVL_NB_13, LVL_NM_13, S_LVL14, LVL14, NM_LONG_14,
    LOB_CD_14, LVL_NB_14, LVL_NM_14, S_LVL15, LVL15,
    NM_LONG_15, LOB_CD_15, LVL_NB_15, LVL_NM_15, S_LVL16,
    LVL16, NM_LONG_16, LOB_CD_16, LVL_NB_16, LVL_NM_16,
    S_LVL17, LVL17, NM_LONG_17, LOB_CD_17, LVL_NB_17,
    LVL_NM_17, S_LVL18, LVL18, NM_LONG_18, LOB_CD_18,
    LVL_NB_18, LVL_NM_18, S_LVL19, LVL19, NM_LONG_19,
    LOB_CD_19, LVL_NB_19, LVL_NM_19, S_LVL20, LVL20,
    NM_LONG_20, LOB_CD_20, LVL_NB_20, LVL_NM_20, S_LVL21,
    LVL21, NM_LONG_21, LOB_CD_21, LVL_NB_21, LVL_NM_21,
    S_LVL22, LVL22, NM_LONG_22, LOB_CD_22, LVL_NB_22,
    LVL_NM_22, S_LVL23, LVL23, NM_LONG_23, LOB_CD_23,
    LVL_NB_23, LVL_NM_23, S_LVL24, LVL24, NM_LONG_24,
    LOB_CD_24, LVL_NB_24, LVL_NM_24, S_LVL25, LVL25,
    NM_LONG_25, LOB_CD_25, LVL_NB_25, LVL_NM_25, S_LVL26,
    LVL26, NM_LONG_26, LOB_CD_26, LVL_NB_26, LVL_NM_26,
    S_LVL27, LVL27, NM_LONG_27, LOB_CD_27, LVL_NB_27,
    LVL_NM_27, S_LVL28, LVL28, NM_LONG_28, LOB_CD_28,
    LVL_NB_28, LVL_NM_28, S_LVL29, LVL29, NM_LONG_29,
    LOB_CD_29, LVL_NB_29, LVL_NM_29, S_LVL30, LVL30,
    NM_LONG_30, LOB_CD_30, LVL_NB_30, LVL_NM_30)
    AS
    WITH parse1 AS
    (SELECT hrchy_id, fre_id, bu_node_id s_node_id, eff_from_dt, eff_to_dt, active_flg, hrchy_nm_long,
         substr(path, instr(path, '/', 1, 1) +1, instr(path, '/', 1, 2) - instr(path, '/', 1, 1) -1) gen_prnt1,
         substr(path, instr(path, '/', 1, 2) +1, instr(path, '/', 1, 3) - instr(path, '/', 1, 2) -1) gen_prnt2,
         substr(path, instr(path, '/', 1, 3) +1, instr(path, '/', 1, 4) - instr(path, '/', 1, 3) -1) gen_prnt3,
         substr(path, instr(path, '/', 1, 4) +1, instr(path, '/', 1, 5) - instr(path, '/', 1, 4) -1) gen_prnt4,
         substr(path, instr(path, '/', 1, 5) +1, instr(path, '/', 1, 6) - instr(path, '/', 1, 5) -1) gen_prnt5,
         substr(path, instr(path, '/', 1, 6) +1, instr(path, '/', 1, 7) - instr(path, '/', 1, 6) -1) gen_prnt6,
         substr(path, instr(path, '/', 1, 7) +1, instr(path, '/', 1, 8) - instr(path, '/', 1, 7) -1) gen_prnt7,
         substr(path, instr(path, '/', 1, 8) +1, instr(path, '/', 1, 9) - instr(path, '/', 1, 8) -1) gen_prnt8,
         substr(path, instr(path, '/', 1, 9) +1, instr(path, '/', 1, 10) - instr(path, '/', 1, 9) -1) gen_prnt9,
         substr(path, instr(path, '/', 1, 10) +1, instr(path, '/', 1, 11) - instr(path, '/', 1, 10) -1) gen_prnt10,
         substr(path, instr(path, '/', 1, 11) +1, instr(path, '/', 1, 12) - instr(path, '/', 1, 11) -1) gen_prnt11,
         substr(path, instr(path, '/', 1, 12) +1, instr(path, '/', 1, 13) - instr(path, '/', 1, 12) -1) gen_prnt12,
         substr(path, instr(path, '/', 1, 13) +1, instr(path, '/', 1, 14) - instr(path, '/', 1, 13) -1) gen_prnt13,
         substr(path, instr(path, '/', 1, 14) +1, instr(path, '/', 1, 15) - instr(path, '/', 1, 14) -1) gen_prnt14,
         substr(path, instr(path, '/', 1, 15) +1, instr(path, '/', 1, 16) - instr(path, '/', 1, 15) -1) gen_prnt15,
         substr(path, instr(path, '/', 1, 16) +1, instr(path, '/', 1, 17) - instr(path, '/', 1, 16) -1) gen_prnt16,
         substr(path, instr(path, '/', 1, 17) +1, instr(path, '/', 1, 18) - instr(path, '/', 1, 17) -1) gen_prnt17,
         substr(path, instr(path, '/', 1, 18) +1, instr(path, '/', 1, 19) - instr(path, '/', 1, 18) -1) gen_prnt18,
         substr(path, instr(path, '/', 1, 19) +1, instr(path, '/', 1, 20) - instr(path, '/', 1, 19) -1) gen_prnt19,
         substr(path, instr(path, '/', 1, 20) +1, instr(path, '/', 1, 21) - instr(path, '/', 1, 20) -1) gen_prnt20,
         substr(path, instr(path, '/', 1, 21) +1, instr(path, '/', 1, 22) - instr(path, '/', 1, 21) -1) gen_prnt21,
         substr(path, instr(path, '/', 1, 22) +1, instr(path, '/', 1, 23) - instr(path, '/', 1, 22) -1) gen_prnt22,
         substr(path, instr(path, '/', 1, 23) +1, instr(path, '/', 1, 24) - instr(path, '/', 1, 23) -1) gen_prnt23,
         substr(path, instr(path, '/', 1, 24) +1, instr(path, '/', 1, 25) - instr(path, '/', 1, 24) -1) gen_prnt24,
         substr(path, instr(path, '/', 1, 25) +1, instr(path, '/', 1, 26) - instr(path, '/', 1, 25) -1) gen_prnt25,
         substr(path, instr(path, '/', 1, 26) +1, instr(path, '/', 1, 27) - instr(path, '/', 1, 26) -1) gen_prnt26,
         substr(path, instr(path, '/', 1, 27) +1, instr(path, '/', 1, 28) - instr(path, '/', 1, 27) -1) gen_prnt27,
         substr(path, instr(path, '/', 1, 28) +1, instr(path, '/', 1, 29) - instr(path, '/', 1, 28) -1) gen_prnt28,
         substr(path, instr(path, '/', 1, 29) +1, instr(path, '/', 1, 30) - instr(path, '/', 1, 29) -1) gen_prnt29,
         substr(path, instr(path, '/', 1, 30) +1, instr(path, '/', 1, 31) - instr(path, '/', 1, 30) -1) gen_prnt30,
    hrchy_lvl_nb
    FROM rpt_bu_gen_rev_v),
    parse2 AS
    (SELECT a.hrchy_id, a.fre_id, a.s_node_id s_bu_id, LTRIM(a.s_node_id,'S') bu_id, a.eff_from_dt, a.eff_to_dt,
    a.active_flg, a.hrchy_nm_long,
    a.hrchy_lvl_nb, a.gen_prnt1 s_lvl1,
    LTRIM (a.gen_prnt1, 'S') lvl1, a.gen_prnt2 s_lvl2,
    LTRIM (a.gen_prnt2, 'S') lvl2, a.gen_prnt3 s_lvl3,
    LTRIM (a.gen_prnt3, 'S') lvl3, a.gen_prnt4 s_lvl4,
    LTRIM (a.gen_prnt4, 'S') lvl4, a.gen_prnt5 s_lvl5,
    LTRIM (a.gen_prnt5, 'S') lvl5, a.gen_prnt6 s_lvl6,
    LTRIM (a.gen_prnt6, 'S') lvl6, a.gen_prnt7 s_lvl7,
    LTRIM (a.gen_prnt7, 'S') lvl7, a.gen_prnt8 s_lvl8,
    LTRIM (a.gen_prnt8, 'S') lvl8, a.gen_prnt9 s_lvl9,
    LTRIM (a.gen_prnt9, 'S') lvl9, a.gen_prnt10 s_lvl0,
    LTRIM (a.gen_prnt10, 'S') lvl10, a.gen_prnt11 s_lvl11,
    LTRIM (a.gen_prnt11, 'S') lvl11, a.gen_prnt12 s_lvl12,
    LTRIM (a.gen_prnt12, 'S') lvl12, a.gen_prnt13 s_lvl13,
    LTRIM (a.gen_prnt13, 'S') lvl13, a.gen_prnt14 s_lvl14,
    LTRIM (a.gen_prnt14, 'S') lvl14, a.gen_prnt15 s_lvl15,
    LTRIM (a.gen_prnt15, 'S') lvl15, a.gen_prnt16 s_lvl16,
    LTRIM (a.gen_prnt16, 'S') lvl16, a.gen_prnt17 s_lvl17,
    LTRIM (a.gen_prnt17, 'S') lvl17, a.gen_prnt18 s_lvl18,
    LTRIM (a.gen_prnt18, 'S') lvl18, a.gen_prnt19 s_lvl19,
    LTRIM (a.gen_prnt19, 'S') lvl19, a.gen_prnt20 s_lvl20,
    LTRIM (a.gen_prnt20, 'S') lvl20, a.gen_prnt21 s_lvl21,
    LTRIM (a.gen_prnt21, 'S') lvl21, a.gen_prnt22 s_lvl22,
    LTRIM (a.gen_prnt22, 'S') lvl22, a.gen_prnt23 s_lvl23,
    LTRIM (a.gen_prnt23, 'S') lvl23, a.gen_prnt24 s_lvl24,
    LTRIM (a.gen_prnt24, 'S') lvl24, a.gen_prnt25 s_lvl25,
    LTRIM (a.gen_prnt25, 'S') lvl25, a.gen_prnt26 s_lvl26,
    LTRIM (a.gen_prnt26, 'S') lvl26, a.gen_prnt27 s_lvl27,
    LTRIM (a.gen_prnt27, 'S') lvl27, a.gen_prnt28 s_lvl28,
    LTRIM (a.gen_prnt28, 'S') lvl28, a.gen_prnt29 s_lvl29,
    LTRIM (a.gen_prnt29, 'S') lvl29, a.gen_prnt30 s_lvl30,
    LTRIM (a.gen_prnt30, 'S') lvl30
    FROM parse1 a)
    SELECT b.hrchy_id, b.fre_id, b.s_bu_id, b.bu_id, b.eff_from_dt, b.eff_to_dt, b.active_flg, b.hrchy_nm_long, b.hrchy_lvl_nb,
    CAST(b.s_lvl1 AS VARCHAR2(13)) s_lvl1,
    CAST(b.lvl1 AS VARCHAR2(13)) lvl1,
    (CASE WHEN b.lvl1 is not null then (select x.nm_long from bu x where x.fre_id=b.fre_id and x.bu_id=b.lvl1)END) nm_long_1,
    (CASE WHEN b.lvl2 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl2)END) lob_cd_1,
    '' lvl_nb_1,
    '' lvl_nm_1,
    CAST(b.s_lvl2 AS VARCHAR2(13)) s_lvl2,
    CAST(b.lvl2 AS VARCHAR2(13)) lvl2,
    (CASE WHEN b.lvl2 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl2)END) nm_long_2,
    (CASE WHEN b.lvl2 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl2)END) lob_cd_2,
    '' lvl_nb_2,
    '' lvl_nm_2,
    CAST(b.s_lvl3 AS VARCHAR2(13)) s_lvl3,
    CAST(b.lvl3 AS VARCHAR2(13)) lvl,
    (CASE WHEN b.lvl3 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl3)END) nm_long_3,
    (CASE WHEN b.lvl3 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl3)END) lob_cd_3,
    '' lvl_nb_3,
    '' lvl_nm_3,
    CAST(b.s_lvl4 AS VARCHAR2(13)) s_lvl4,
    CAST(b.lvl4 AS VARCHAR2(13)) lvl4,
    (CASE WHEN b.lvl4 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl4)END) nm_long_4,
    (CASE WHEN b.lvl4 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl4)END) lob_cd_4,
    '' lvl_nb_4,
    '' lvl_nm_4,
    CAST(b.s_lvl5 AS VARCHAR2(13)) s_lvl5,
    CAST(b.lvl5 AS VARCHAR2(13)) lvl5,
    (CASE WHEN b.lvl5 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl5)END) nm_long_5,
    (CASE WHEN b.lvl5 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl5)END) lob_cd_5,
    '' lvl_nb_5,
    '' lvl_nm_5,
    CAST(b.s_lvl6 AS VARCHAR2(13)) s_lvl6,
    CAST(b.lvl6 AS VARCHAR2(13)) lvl6,
    (CASE WHEN b.lvl6 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl6)END) nm_long_6,
    (CASE WHEN b.lvl6 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl6)END) lob_cd_6,
    '' lvl_nb_6,
    '' lvl_nm_6,
    CAST(b.s_lvl7 AS VARCHAR2(13)) s_lvl7,
    CAST(b.lvl7 AS VARCHAR2(13)) lvl7,
    (CASE WHEN b.lvl7 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl7)END) nm_long_7,
    (CASE WHEN b.lvl7 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl7)END) lob_cd_7,
    '' lvl_nb_7,
    '' lvl_nm_7,
    CAST(b.s_lvl8 AS VARCHAR2(13)) s_lvl8,
    CAST(b.lvl8 AS VARCHAR2(13)) lvl8,
    (CASE WHEN b.lvl8 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl8)END) nm_long_8,
    (CASE WHEN b.lvl8 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl8)END) lob_cd_8,
    '' lvl_nb_8,
    '' lvl_nm_8,
    CAST(b.s_lvl9 AS VARCHAR2(13)) s_lvl9,
    CAST(b.lvl9 AS VARCHAR2(13)) lvl9,
    (CASE WHEN b.lvl9 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl9)END) nm_long_9,
    (CASE WHEN b.lvl9 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl9)END) lob_cd_9,
    '' lvl_nb_9,
    '' lvl_nm_9,
    CAST(b.s_lvl0 AS VARCHAR2(13)) s_lvl10,
    CAST(b.lvl10 AS VARCHAR2(13)) lvl10,
    (CASE WHEN b.lvl10 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl10)END) nm_long_10,
    (CASE WHEN b.lvl10 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl10)END) lob_cd_10,
    '' lvl_nb_10,
    '' lvl_nm_10,
    CAST(b.s_lvl11 AS VARCHAR2(13)) s_lvl11,
    CAST(b.lvl11 AS VARCHAR2(13)) lvl11,
    (CASE WHEN b.lvl11 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl11)END) nm_long_11,
    (CASE WHEN b.lvl11 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl11)END) lob_cd_11,
    '' lvl_nb_11,
    '' lvl_nm_11,
    CAST(b.s_lvl12 AS VARCHAR2(13)) s_lvl12,
    CAST(b.lvl12 AS VARCHAR2(13)) lvl12,
    (CASE WHEN b.lvl12 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl12)END) nm_long_12,
    (CASE WHEN b.lvl12 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl12)END) lob_cd_12,
    '' lvl_nb_12,
    '' lvl_nm_12,
    CAST(b.s_lvl13 AS VARCHAR2(13)) s_lvl13,
    CAST(b.lvl13 AS VARCHAR2(13)) lvl13,
    (CASE WHEN b.lvl13 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl13)END) nm_long_13,
    (CASE WHEN b.lvl13 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl13)END) lob_cd_13,
    '' lvl_nb_13,
    '' lvl_nm_13,
    CAST(b.s_lvl14 AS VARCHAR2(13)) s_lvl14,
    CAST(b.lvl14 AS VARCHAR2(13)) lvl14,
    (CASE WHEN b.lvl14 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl14)END) nm_long_14,
    (CASE WHEN b.lvl14 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl14)END) lob_cd_14,
    '' lvl_nb_14,
    '' lvl_nm_14,
    CAST(b.s_lvl15 AS VARCHAR2(13)) s_lvl15,
    CAST(b.lvl15 AS VARCHAR2(13)) lvl15,
    (CASE WHEN b.lvl15 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl15)END) nm_long_15,
    (CASE WHEN b.lvl15 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl15)END) lob_cd_15,
    '' lvl_nb_15,
    '' lvl_nm_15,
    CAST(b.s_lvl16 AS VARCHAR2(13)) s_lvl16,
    CAST(b.lvl16 AS VARCHAR2(13)) lvl16,
    (CASE WHEN b.lvl16 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl16)END) nm_long_16,
    (CASE WHEN b.lvl16 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl16)END) lob_cd_16,
    '' lvl_nb_16,
    '' lvl_nm_16,
    CAST(b.s_lvl17 AS VARCHAR2(13)) s_lvl17,
    CAST(b.lvl17 AS VARCHAR2(13)) lvl17,
    (CASE WHEN b.lvl17 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl17)END) nm_long_17,
    (CASE WHEN b.lvl17 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl17)END) lob_cd_17,
    '' lvl_nb_17,
    '' lvl_nm_17,
    CAST(b.s_lvl18 AS VARCHAR2(13)) s_lvl18,
    CAST(b.lvl18 AS VARCHAR2(13)) lvl18,
    (CASE WHEN b.lvl18 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl8)END) nm_long_18,
    (CASE WHEN b.lvl18 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl18)END) lob_cd_18,
    '' lvl_nb_18,
    '' lvl_nm_18,
    CAST(b.s_lvl19 AS VARCHAR2(13)) s_lvl19,
    CAST(b.lvl19 AS VARCHAR2(13)) lvl19,
    (CASE WHEN b.lvl19 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl19)END) nm_long_19,
    (CASE WHEN b.lvl19 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl19)END) lob_cd_19,
    '' lvl_nb_19,
    '' lvl_nm_19,
    CAST(b.s_lvl20 AS VARCHAR2(13)) s_lvl20,
    CAST(b.lvl20 AS VARCHAR2(13)) lvl20,
    (CASE WHEN b.lvl20 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl20)END) nm_long_20,
    (CASE WHEN b.lvl20 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl20)END) lob_cd_20,
    '' lvl_nb_20,
    '' lvl_nm_20,
    CAST(b.s_lvl21 AS VARCHAR2(13)) s_lvl21,
    CAST(b.lvl21 AS VARCHAR2(13)) lvl21,
    (CASE WHEN b.lvl21 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl21)END) nm_long_21,
    (CASE WHEN b.lvl21 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl21)END) lob_cd_21,
    '' lvl_nb_21,
    '' lvl_nm_21,
    CAST(b.s_lvl22 AS VARCHAR2(13)) s_lvl22,
    CAST(b.lvl22 AS VARCHAR2(13)) lvl22,
    (CASE WHEN b.lvl22 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl22)END) nm_long_22,
    (CASE WHEN b.lvl22 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl22)END) lob_cd_22,
    '' lvl_nb_22,
    '' lvl_nm_22,
    CAST(b.s_lvl23 AS VARCHAR2(13)) s_lvl23,
    CAST(b.lvl23 AS VARCHAR2(13)) lvl23,
    (CASE WHEN b.lvl23 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl23)END) nm_long_23,
    (CASE WHEN b.lvl23 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl23)END) lob_cd_23,
    '' lvl_nb_23,
    '' lvl_nm_23,
    CAST(b.s_lvl24 AS VARCHAR2(13)) s_lvl24,
    CAST(b.lvl24 AS VARCHAR2(13)) lvl24,
    (CASE WHEN b.lvl24 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl24)END) nm_long_24,
    (CASE WHEN b.lvl24 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl24)END) lob_cd_24,
    '' lvl_nb_24,
    '' lvl_nm_24,
    CAST(b.s_lvl25 AS VARCHAR2(13)) s_lvl25,
    CAST(b.lvl25 AS VARCHAR2(13)) lvl25,
    (CASE WHEN b.lvl25 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl25)END) nm_long_25,
    (CASE WHEN b.lvl25 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl25)END) lob_cd_25,
    '' lvl_nb_25,
    '' lvl_nm_25,
    CAST(b.s_lvl26 AS VARCHAR2(13)) s_lvl26,
    CAST(b.lvl26 AS VARCHAR2(13)) lvl26,
    (CASE WHEN b.lvl26 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl26)END) nm_long_26,
    (CASE WHEN b.lvl26 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl26)END) lob_cd_26,
    '' lvl_nb_26,
    '' lvl_nm_26,
    CAST(b.s_lvl27 AS VARCHAR2(13)) s_lvl27,
    CAST(b.lvl27 AS VARCHAR2(13)) lvl27,
    (CASE WHEN b.lvl27 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl27)END) nm_long_27,
    (CASE WHEN b.lvl27 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl27)END) lob_cd_27,
    '' lvl_nb_27,
    '' lvl_nm_27,
    CAST(b.s_lvl28 AS VARCHAR2(13)) s_lvl28,
    CAST(b.lvl28 AS VARCHAR2(13)) lvl28,
    (CASE WHEN b.lvl28 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl28)END) nm_long_28,
    (CASE WHEN b.lvl28 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl28)END) lob_cd_28,
    '' lvl_nb_28,
    '' lvl_nm_28,
    CAST(b.s_lvl29 AS VARCHAR2(13)) s_lvl29,
    CAST(b.lvl29 AS VARCHAR2(13)) lvl29,
    (CASE WHEN b.lvl29 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl29)END) nm_long_29,
    (CASE WHEN b.lvl29 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl29)END) lob_cd_29,
    '' lvl_nb_29,
    '' lvl_nm_29,
    CAST(b.s_lvl30 AS VARCHAR2(13)) s_lvl30,
    CAST(b.lvl30 AS VARCHAR2(13)) lvl30,
    (CASE WHEN b.lvl30 is not null then (select x.nm_long from bu_node x where x.bu_node_id=b.lvl30)END) nm_long_30,
    (CASE WHEN b.lvl30 is not null then (select x.lob_cd from bu_node x where x.bu_node_id=b.lvl30)END) lob_cd_30,
    '' lvl_nb_30,
    '' lvl_nm_30
    FROM parse2 b;
    Thanks & Regards,
    Subbu S

    create or replace view tv as
    with t as
    (select 1 id, to_date('01/02/1994','MM/DD/YYYY') dte
    from dual
    union
    select 2 id, to_date('02/02/2000','MM/DD/YYYY') dte
    from dual
    union
    select 3 id, to_date('01/05/1988','MM/DD/YYYY') dte
    from dual
    union
    select 4 id, to_date('06/05/2006','MM/DD/YYYY') dte
    from dual)
    select * from t where dte > (select dte from t where id = 4);
    -- eliminate the necessity of writing the same query more than once.
    WITH Clause will add readability of code.
    If the scenario is such that you need to write the same query inline multiple times, you can name it using WITH clause and then use it.
    In some cases it improves the performance as well. Some times it creates global temp table for the query specified in WITH clause. It can improve performance drastically, if the query is complex.
    The life time of the temp table is only till that query executes.....

  • Feature Request: "View States" (layer visibility state)

    Hi all,
    I've been using Illustrator now for many years.  A large majority of the graphics I create are used in Flash for many of the games I develop.  Some of the graphics are exported from Illustrator as vector art, some are output as raster.
    There is a game that we've been working on recently that demonstrated a large need for a feature I came up with known as "View States."
    Why this is important to me:
    When you have an Illustrator file that contains many graphical elements, no matter how they are arranged in Illustrator using multiple layers or not, it is very, VERY challenging to be able to remember which layers and/or graphical elements should be kept visible, and which shouldn't be kept visible when you are outputing graphics in various ways.
    Going back to the game that my co-worker and I were working on, we have an Illustrator file that has 4 layers at the root level, in those layers, many more graphical elements and sub-layers each containing many, MANY more elements and sub-layers.  The game we are working is designed such that the background of the game is raster art; however, other foreground elements are output as vector art.  Anytime a change needs to be made to the artwork, I have to remember which layers I should hide and which should be kept visible in order to output the necessary graphics in whatever format I need to.
    The first question you may ask is, "Why not simply create a layer structure that allows you to simply hide the foreground or background elements so that you can output exactly what you need?"  That is a very good approach at producing the artwork.  And I'm completely open to changing the way I work being that is the only way I've been able to grow as a digital artist. However, I feel that this feature has merit in providing a simpler way for designers to work if they are unwilling or don't care to change the way they work.  In addition, some of the graphics we developed are grouped in such a way that splitting them could make it more challenging to find pieces of art in a file that has many many layers.
    How this feature may work:
    Basically a new panel titled "View States" would be in the interface.  This panel would allow you to create "view state" instances.  In each instance you provide a name for it to make it easier for you to remember what it is for.
    Each view state, when selected, would hide or show the layers you've set to be visible or not visible for that particular view state, thereby making it easier for the designer to know which graphics need to be output for a particular element of their artwork.  If you want to change the visible properties of a layer for a particular view state, simply select the view state and then alter the visibility property of that layer and it will remember that information for that particular view state.
    There are many other options that could be added for this feature, but I just wanted to get the feature information out there to see what you guys think.

    Hello Sly,
    I did exactly thuch beast for freehand some years ago. It's called Layersets. Perhaps we can discuss this off list first.
    My Email is [email protected]
    regards
    Michael

Maybe you are looking for

  • HELP ME IN step by step installation for sap 4.7 IDEAS AND sap 4.7 EE

    HI EXPERTS CAN ANYBODY GIVE STEP BY STEP INSTALLATION  PROCESS FOR BOTH SAP 4.7 IDEAS AND EE VERSIONS I AM NOT THAT MUCH PROFICIENT IN INSTALLING  I HOPE U R GUIDLINES CAN MAKE ME CLEAR IN INSTALLING I HAVE SOME QUESTIONS RATHER THAN THIS TO ANSWER 1

  • How to make something like this in Edge Animate?

    Hi, I'm hoping to make something like this – https://www.youtube.com/watch?v=OJeDppEHI1g – in Edge Animate but I'm not sure where to start. I'm new to Edge but am keen to explore. Anyone have any feedback on whether: 1. It's possible, and 2. What tec

  • XI Technical and Business System Definitions For MDM 2.0

    Hi, We're trying to define the XI technical and business system definitions for our MDM 2.0 installation to work with SRM 5.0 and PI 7.0. In the documentation we have we can't find reference to what type of a technical and business system to define.

  • Supressing  Issue based on grouping

    Our report has been grouped based on few columns, say(Title, Jobcode, Job Name, Job Description and Status). The set of output for this group would contain these columns say(Rev No#, Job Comments, effectivedate) Our requirement is to suppress the col

  • Site Definition Help - Please

    Dreamweaver in CS3 on Windows XP Prof: Very very beginner: Before I've chosen a folder or site or anything: When I begin to define a site - in the Site Definition window - in Site name: box, "Unnamed Site 2" always appears; In the 'Local root folder: