With clause query issue in oracle cloud script editor

When I am running this query in SQL Workshop > SQL Commands window then its working fine
with cte as (select * from emp)
select * from cte
where deptno = (select deptno from dept where loc = 'DALLAS')
but its give me error in SQL Workshop > Script Editor window
When I did copy & paste query from Script Editor window to notepad,
then I realize that its automatically adding hidden "?" question mark (as per below query)
how can I resolve this issue?
please guide me.
I have confirm that there is no any white space after 'DALLAS')
& another simple queries working fine in both windows.
with cte as (select * from emp)
select * from cte
where deptno = (select deptno from dept where loc = 'DALLAS')?
Edited by: Sanjay on 28 Mar, 2013 6:46 PM

Hi Sanjay,
You have mentioned "+but its give me error in SQL Workshop > Script Editor window+" - are you referring to the SQL Workshop > SQL Scripts > Script Editor option, while editing a SQL script? If so, then I have been unable to reproduce the behaviour you have reported, and have not received any errors using your test query.
To assist in identifying the cause of your problem, could you please outline the exact steps that you followed, leading up to the step where you receive an error?
Regards,
Hilary

Similar Messages

  • WITH Clause query doesn't work in Oracle Reports.

    Hi Gurus,
    I'm using a WITH clause query and need to build a report using the same query.
    But when i'm trying to build a report, query is giving error as "WITH clause table or view doesn't exists".
    But the same query perfectly works in sql prompt.
    Oracle Reports doesn't supports WITH clause query?
    Please suggest.
    Thanks,
    Onkar

    I ran into a similar problem before and worked around it by moving the query to a pipelined function in the database as described at WITH clause unexpectedly causes ORA-00942 in Reports Builder
    Hope this helps.

  • How to use "with clause query" in DBadapter

    Hi all,
    I need to implement a "with clause" query in oracle soa 11g bpel. When i put the query in db adapter in pure sql, the schema is not getting generated properly. Can any one suggest a solution to my problem.
    Regards,
    Kaushik

    Pure SQL won't work because it is expecting the first word in the SQL to be SELECT (or INSERT,UPDATE,DELETE).
    If your query is WITH ... SELECT ...
    try this:
    delete everything before SELECT. Copy and paste the generated XSD to another window. The SQL test may fail, but that will just mean that it couldn't fill in the types of the columns in the SELECT ... FROM list. You can always do that yourself by hand editing the XSD (including in the wizard before you hit next). Then put back the WITH ... clause before the remaining SELECT .... If the XSD gets overwritten, copy the version you saved in the other window and paste it over top. Then hit next and the runtime should still work.
    Keep in mind that SQL is very complex and hard to fully parse in the UI. However the minimum information the DbAdapter needs is quite limited; basically just the name and number of columns that are coming back. The XSD is meant to be editable in the wizard if the SQL is too complex.
    Thanks
    Steve

  • WITH clause query:- Returns No Rows

    Hi,
    I am using the following query with, WITH clause, but some how it give "0 rows" returned,
    The underlying query does returns row when run in stand alone mode,
    With v_score_his_old
    As
    SELECT schs_run_date,schs_loc_shortcut_source,schs_lot_number,schs_facility_new,schs_facility_old, schs_operation_new,
    schs_operation_old,schs_route_new,schs_route_old,schs_product_new,schs_product_old,schs_owner_old,schs_intransit,
    schs_date,schs_transaction,schs_quantity_1_new,schs_quantity_1_old,/*0,*/schs_if_count_new,schs_if_count_old,
    schs_preprocessed,schs_consumed_quantity,/*'Y',*/schs_if_id,schs_if_id_old,fif_fac_loc_id
    FROM scm_score_his,full_item_facilities,location_params
    WHERE schs_state = 0
    AND fif_if_id = schs_if_id_old
    AND lopo_param_value = to_char(fif_site_id_fm)
    AND lopo_param_name IN ('SITE_FAB', 'SITE_SORT')
    AND (schs_loc_shortcut_source = 'MP' OR schs_loc_shortcut_source = 'RE' OR schs_loc_shortcut_source = 'VI')
    UNION ALL
    SELECT schb_run_date,schb_loc_shortcut_source,schb_lot_number,schb_facility_new,schb_facility_old,schb_operation_new,
    schb_operation_old,schb_route_new,schb_route_old,schb_product_new,schb_product_old,schb_owner_old,schb_intransit,
    schb_date,schb_transaction,schb_quantity_1_new,schb_quantity_1_old,/*0,*/schb_if_count_new,schb_if_count_old,schb_preprocessed,
    schb_consumed_quantity,/*'Y',*/schb_if_id,schb_if_id_old,fif_fac_loc_id
    FROM scm_score_his_backups,full_item_facilities,location_params
    WHERE schb_state = 0
    AND fif_if_id = schb_if_id_old
    AND lopo_param_value = to_char(fif_site_id_fm)
    AND lopo_param_name IN ('SITE_FAB', 'SITE_SORT')
    AND schb_date >= trunc(sysdate - 84)
    AND (schb_loc_shortcut_source = 'MP' OR schb_loc_shortcut_source = 'RE' OR schb_loc_shortcut_source = 'VI')
    Select schs_run_date,schs_loc_shortcut_source,schs_lot_number
    From v_score_his_old
    Where schs_loc_shortcut_source = 'MP';
    Oracle version is Oracle9i Enterprise Edition Release 9.2.0.6.0
    I am not able to get where I can going wrong.
    Please help me to understand this issue,
    Regards
    Umesh..

    With v_score_his_old
    As
    SELECT
    schs_run_date,schs_loc_shortcut_source,schs_lot_numbe
    ,schs_facility_new,schs_facility_old,
    schs_operation_new,
    chs_operation_old,schs_route_new,schs_route_old,schs_p
    roduct_new,schs_product_old,schs_owner_old,schs_intran
    sit,
    chs_date,schs_transaction,schs_quantity_1_new,schs_qua
    ntity_1_old,/*0,*/schs_if_count_new,schs_if_count_old,
    chs_preprocessed,schs_consumed_quantity,/*'Y',*/schs_i
    f_id,schs_if_id_old,fif_fac_loc_id
    FROM
    cm_score_his,full_item_facilities,location_params
    WHERE schs_state = 0
    AND fif_if_id = schs_if_id_old
    AND lopo_param_value =
    to_char(fif_site_id_fm)
    AND lopo_param_name IN ('SITE_FAB',
    'SITE_SORT')
    AND (schs_loc_shortcut_source = 'MP' OR
    schs_loc_shortcut_source = 'RE' OR
    schs_loc_shortcut_source = 'VI')
    UNION ALL
    SELECT
    schb_run_date,schb_loc_shortcut_source,schb_lot_number
    ,schb_facility_new,schb_facility_old,schb_operation_ne
    w,
    chb_operation_old,schb_route_new,schb_route_old,schb_p
    roduct_new,schb_product_old,schb_owner_old,schb_intran
    sit,
    chb_date,schb_transaction,schb_quantity_1_new,schb_qua
    ntity_1_old,/*0,*/schb_if_count_new,schb_if_count_old,
    schb_preprocessed,
    chb_consumed_quantity,/*'Y',*/schb_if_id,schb_if_id_ol
    d,fif_fac_loc_id
    FROM
    cm_score_his_backups,full_item_facilities,location_par
    ams
    WHERE schb_state = 0
    AND fif_if_id = schb_if_id_old
    AND lopo_param_value =
    to_char(fif_site_id_fm)
    AND lopo_param_name IN ('SITE_FAB',
    'SITE_SORT')
    AND schb_date >= trunc(sysdate - 84)
    AND (schb_loc_shortcut_source = 'MP' OR
    schb_loc_shortcut_source = 'RE' OR
    schb_loc_shortcut_source = 'VI')
    ect
    schs_run_date,schs_loc_shortcut_source,schs_lot_number
    From v_score_his_old
    Where schs_loc_shortcut_source = 'MP';
    Hi!
    I've a doubt. If u finally picking all the values which matched with field schs_loc_shortcut_source and which is 'MP' - then why r u using multiple condition in the WITH part? So, in that case, u don't have to write that additional filtering of the following lines in the outer query -
    Where schs_loc_shortcut_source = 'MP';Regards.
    Satyaki De.

  • Need help in 'WITH CLAUSE' Query

    Hello Gurus,
    I am trying to calculate the count of distinct members for each provid.
    I am using the with clause to get information regarding the provid.
       WITH T AS
      (SELECT a.UD_ID MRR_ID,
                            A.UD_LASTNAME LAST_NAME,
                            A.UD_FIRSTNAME FIRST_NAME,
                            COUNT(DISTINCT DP.PA_PROVIDERID) PROVIDERS_ASSIGNED
                       FROM (SELECT UD.UD_ID,
                                    UD_LASTNAME,
                                    UD_FIRSTNAME
                               FROM USER_DETAILS       UD,
                                    MAP_USERS_TO_ROLES MR
                              WHERE MR.MUR_UR_ID_REF = 1000
                                AND MR.MUR_UD_ID_REF = UD.UD_ID) A,
                            D4C_PROVIDER_ASSIGNMENT DP
                      WHERE A.UD_ID = DP.PA_ASSIGNEDTO
                      AND dp.pa_status ='A'
                      GROUP BY A.UD_ID,
                               A.UD_LASTNAME,
                               A.UD_FIRSTNAME
                      ORDER BY 3 DESC)    OUTPUT of just above query without WITH clause.
    MRR_ID     LAST_NAME     FIRST_NAME     PROVIDERS_ASSIGNED
    1229    mrrTest         mrrTest         4
    1228    mrr2Last        mrr2First       5
    1230    mrr1Last        mrr1First       7
    1226    Panwar          SIngh           1
    1181    MRRLast         MRRTest         4
    1221    One             MRR             1
    1322    Thakuria        Bibhuthi        2I am creating this and get all the information to show on front end. Now I want to calculate the no of members as per the providers assigned for each MRR_ID
    Below query show the no of members for all the providers assigned to a provider.
    ex:
    SELECT * FROM (   
    SELECT COUNT(DISTINCT dmpc_hicn) countmember
    FROM D4C_HICN_PROVIDER_claims  a WHERE trim(DPMC_PROVIDER_NO) IN 
    (SELECT trim(pa_providerid)
       FROM d4c_provider_assignment
       WHERE pa_assignedto = 1181  (mrr_id)    --here i have use the mrrid from with clause and get the member count with all the columns coming from WITH CLAUSE.
       AND pa_roleid = 1000
       AND PA_STATUS ='A'
    GROUP BY a.dmpc_ss_id_ref)Right now I am using materialized view i dont wanna use the same..
    I am sending the materialized view code as well what i am doing ..
    ( SELECT SUM(member_count)member_count_bynpi ,mrr_id  FROM (
    (SELECT count(DISTINCT hp.dmpc_hicn) member_count,hp.DMPC_SS_ID_REF ,a1.ud_id mrr_id FROM  D4C_HICN_PROVIDER_claims hp ,
    (SELECT   a.UD_ID ,DP.PA_PROVIDERID
         FROM (SELECT UD.UD_ID, UD_LASTNAME, UD_FIRSTNAME
                 FROM USER_DETAILS UD, MAP_USERS_TO_ROLES MR
                WHERE MR.MUR_UR_ID_REF = 1000
                  AND MR.MUR_UD_ID_REF = UD.UD_ID) A,
              D4C_PROVIDER_ASSIGNMENT DP
        WHERE A.UD_ID = DP.PA_ASSIGNEDTO
        AND dp.pa_status ='A'
        /*AND dp.PA_ASSIGNEDTO = 1221*/) a1
        WHERE trim(a1.PA_PROVIDERID) = trim(hp.dpmc_provider_no)
        GROUP BY a1.ud_id,hp.DMPC_SS_ID_REF))
        GROUP BY mrr_id)Please help me to write the code with the materialized view. Thanks in Advance.
    Kind regards,
    UP
    Edited by: BluShadow on 22-Aug-2011 07:58
    fixed {noformat}{noformat} tags.  Please use lowercase "code" rather than uppercase "CODE" in the tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Probably, this may help
    WITH T1 as(
               SELECT UD.UD_ID,
                      UD_LASTNAME,
                      UD_FIRSTNAME
                FROM USER_DETAILS UD, MAP_USERS_TO_ROLES MR
                WHERE MR.MUR_UR_ID_REF = 1000
                AND MR.MUR_UD_ID_REF = UD.UD_ID)
          T2 as (SELECT a.UD_ID ,DP.PA_PROVIDERID
                 FROM T1 A, D4C_PROVIDER_ASSIGNMENT DP
                 WHERE A.UD_ID = DP.PA_ASSIGNEDTO
                 AND dp.pa_status ='A')
           T3 as(SELECT count(DISTINCT hp.dmpc_hicn) member_count,
                              hp.DMPC_SS_ID_REF ,
                               a1.ud_id mrr_id
                  FROM T2 A1 ,D4C_HICN_PROVIDER_claims hp
                  WHERE trim(a1.PA_PROVIDERID) = trim(hp.dpmc_provider_no)
                  GROUP BY a1.ud_id,hp.DMPC_SS_ID_REF)
    SELECT SUM(member_count)member_count_bynpi ,mrr_id from T3
    GROUP BY mrr_id

  • How to use hint on with clause query

    Hi all,
    I have a query and it consits full of tabs with WITH clause. Top level I am just selecting all the tabs (queries with WITH clause) by saying select * from tab1,tab2,.....so on .
    Now my question is If I want to use hint on my SQL can I use the same by using tab1,tab2...
    tab1, tab2 are not actually tables ....each tab represents one SQL with WITH clause.
    Please let me know if there is any confusion on my post.

    What's stopping you from trying it yourself?
    Post your results here to help others.

  • WITH clause querying other WITH clause

    I want to do something like this:
    with t1 as
        select * from table1
    ,t2 as
        select col1,col2 from t1
    select * from t1,t2as you all can see, t2 WITH clause queries t1 WITH clause. how do I do this? because this doesn't work. thanks

    how do I do this?Works fine for me on my 11.2.0.2:
    SQL> with t1 as (select dname from dept),
         t2 as (select dname from t1)
    select t1.dname d1, t2.dname d2
      from t1, t2
    D1                    D2                  
    ACCOUNTING            ACCOUNTING          
    ACCOUNTING            RESEARCH            
    ACCOUNTING            SALES               
    ACCOUNTING            OPERATIONS          
    ACCOUNTING            SALES               
    RESEARCH              ACCOUNTING          
    RESEARCH              RESEARCH            
    RESEARCH              SALES               
    RESEARCH              OPERATIONS          
    RESEARCH              SALES               
    SALES                 ACCOUNTING          
    SALES                 RESEARCH            
    SALES                 SALES               
    SALES                 OPERATIONS          
    SALES                 SALES               
    OPERATIONS            ACCOUNTING          
    OPERATIONS            RESEARCH            
    OPERATIONS            SALES               
    OPERATIONS            OPERATIONS          
    OPERATIONS            SALES               
    SALES                 ACCOUNTING          
    SALES                 RESEARCH            
    SALES                 SALES               
    SALES                 OPERATIONS          
    SALES                 SALES               
    25 rows selected.

  • Oracle XE script editor not working

    Hi!
    i installed oracle xe on windows vista.
    But somehow i cant seem to use the script editor i.e. i cannot type in anything into the editor.
    the entire editor just appears red.
    browser: Google Chrome.
    please reply
    Edited by: user10296156 on Jan 21, 2010 9:13 AM

    Try using Firefox or IE (ugh!).
    :p

  • Tabular model with Direct Query issue

    Hi,
    i am creating a tabular model - Direct Query option. I am using a kind of below query to import data,
    Declare @TEST as Table (TestID int, TestName varchar(20))
    Insert into @TEST
    Select 1, 'TEst1' Union
    Select 2, 'TEst2'
    Select * from @TEST
    But the Import fails with an error similar to below,
    OLE DB or ODBC error.  An error occurred while processing the partition 'Query_``````````' in table 'Query_````````'.  The current operation was cancelled because another operation in the transaction failed.
    Any idea, why it is failing ? or is it like we shouldn't use declare statement in the Query area ?
    Please reply ...Thanks in advance !
    --------------------------- Radhai Krish | Golden Age is no more far | --------------------------

    I'm pretty sure that the query would have to be a single statement so the declare statement would be causing issues.
    So just doing this as a single union query should work:
    Select 1 as TestID, 'TEst1' as TestName Union
    Select 2, 'TEst2'
    http://darren.gosbell.com - please mark correct answers

  • With clause query with self join

    dear all ,
    i have the following table
    Name                                      Null?    Type
    SURVEY_ID                                 NOT NULL NUMBER(5)
    USER_ID                                   NOT NULL VARCHAR2(15)
    ACADEMIC_SEMESTER                                  VARCHAR2(25)
    USER_TYPE                                          VARCHAR2(7)
    Q1                                            NUMBER(1)
    Q2                                            NUMBER(1)Q1 and Q2 both have five questions 1,2,3,4,5.
    i want to see how much user has slected option 1, how much user select option2 so on and so forth for each question.
    how to do this?
    i write the following query
    with
    Q1_count as (
    select Q1_STAFF,Q13_STAFF,SURVEY_ID,user_id from css_survey
    select count(c.user_id) total_users ,q.Q1_STAFF,q.Q13_STAFF
    from css_survey c,q1_count q
    where c.survey_id=q.SURVEY_ID and c.user_id=q.user_id
    group by q.Q1_STAFF,q.Q13_STAFF
    which generates the following results
    TOTAL_USERS     Q1         Q2
              1              2               5
              1              5               5instead i need the below results;
    TOTAL_USERS     Q1         Q2
              1              2              
              1              5              
              1                            5
              1                            5kindly help.

    okay,
    below is the detail;
    create table css_survey(survey_id number primary key,
    user_id varchar2(30),user_type varchar2(10),academic_semester varchar2(30),
    q1 number,q2 number);
    insert into css_survey values(1,'et04','staff','2010',1,3);
    insert into css_survey values(2,'et03','staff','2010',1,4);
    insert into css_survey values(3,'et05','staff','2010',2,3);
    insert into css_survey values(4,'et06','staff','2010',4,4);
    insert into css_survey values(5,'et07','staff','2010',4,4);
    insert into css_survey values(6,'et08','staff','2010',5,5);
    commit;
    select count(user_id) as total_users,q1,q2
    from css_survey
    group by grouping sets(q1,q2);
    TOTAL_USERS         Q1         Q2
              2                  1
              1                  2
              2                  4
              1                  5
              3                                  4
              1                                  5
              2                                  3
    7 rows selected.and ofcourse this is my desired result.
    thank you so much.

  • PL/SQL WITH Clause

    Hi Gurus,
    I have been trying to find more information regarding the WITH CLAUSE, but most of the info I find is related to Forums. Do you know where i could find Oracle specific documentation on this? I really like using that clause, but i have noticed some drastic performance differences with it compared to the same query run outside of the WITH CLAUSE.
    Just wanted to find some documentation on it and can't seem to find anything.
    As always greatly appreciate the info/feedback.
      Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
      PL/SQL Release 10.2.0.3.0 - Production
      CORE     10.2.0.3.0     Production
      TNS for Linux: Version 10.2.0.3.0 - Production
      NLSRTL Version 10.2.0.3.0 - ProductionThanks,
    S

    Here it goes:
    Using With Clause:
    11g
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10578/tdpdw_sql.htm#TDPDW0073
    10g
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/aggreg.htm#sthref1670
    subquery_factoring_clause:
    11g
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF01702
    10g
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#SQLRF01702
    Edited by: fsitja on Apr 15, 2010 5:14 PM

  • WITH clause unexpectedly causes ORA-00942 in Reports Builder

    I'm posting this in the hope that:
    a) My workaround might help someone if they ever run into the same problem, and/or,
    b) Someone might have a better workaround.
    The problem is that I get unexpected ORA-00942 (table or view does not exist) errors when I try to set the SQL Query Statement property of a Query object in Reports Builder to certain SELECT statements that contain a WITH clause (aka subquery factoring clause).
    For example, the following SELECT statement executes as expected in SQL*Plus...
    SQL> WITH
      2      SUB_QUERY AS
      3      (
      4          SELECT
      5              1 AS X
      6          FROM
      7              DUAL
      8      )
      9  SELECT
    10      INLINE_VIEW.X
    11  FROM   
    12      (
    13          SELECT
    14              NESTED_INLINE_VIEW.X
    15          FROM
    16              (
    17                  SELECT
    18                      SUB_QUERY.X
    19                  FROM
    20                      SUB_QUERY
    21              ) NESTED_INLINE_VIEW
    22      ) INLINE_VIEW;
             X
             1...but when I try to use it as the SQL Query Statement for a Query object in Reports Builder, I get the following error:
    ORA-00942: table or view does not exist
    ==>SUB_QUERY
    My Reports Builder version is 10.1.2.0.2 version and my database version is 10.2.0.3.0.
    The "real" query I have been trying to use is much more complex than this -- this is just the simplest statement I have been able to come up with that causes the problem. In fact, I have some queries that have a similar structure (a WITH clause subquery referenced inside a nested inline view, along with some other things), but strangely do not cause the problem.
    I spent some time researching the problem on Google and Metalink but did not come up with any satisfactory answers. The problem sounds similar to bug 3896963, but bug 3896963 involved UNION ALL, and is supposedly fixed in my version(s).
    I tried various ways of restructuring my "real" query, but with no success -- it's going to be hard to get rid of the WITH clauses. As a "wild guess", I tried various hints (MATERIALIZE, NO_PUSH_PRED, NO_MERGE), again with no success.
    I ended up working around the problem by creating a database package with a function that returns a REF CURSOR based on the query, and then used that in a REF CURSOR query in Reports Builder. It might not be a very elegant workaround, but it works. I just wish I had "given up" and tried it sooner -- I might have saved myself some grief.

    Well, for what it's worth, I didn't end up using a REF CURSOR query after all because...
    If I ran a REP file based on a REF CURSOR query against a different database, or if I ran the REP file after the database package had been dropped and re-created, it failed with the following error:
    REP-8: Run time error in the PL/SQL development environment (DE).
    PDE-PSD001 Could not resolve reference to <Unknown Program Unit> while loading <Unknown> <Unknown>.
    REP-0008: Unexpected memory error while initializing preferences.
    It seems that Reports "binds" the REP file to the timestamp of the database package that defines the REF CURSOR type in order to validate the package at run time. If the timestamp is different, running the REP file will fail with this error. This is apparently bug 1275333 and is described in Metalink Note 272936.1.
    The bug reference and Metalink Note offerred the following workarounds:
    1. Export the database schema that contains the package from one database and import it into the other.
    In some versions, import and export preserve the timestamp, so this would avoid the problem. I didn't try this because it would not be a practical workaround in my situation (upgrade vs. new install).
    2. Recompile the package and manually set the timestamp using the seemingly undocumented ALTER PACKAGE...COMPILE BODY REUSE SETTINGS TIMESTAMP... syntax.
    I didn't try this because I didn't like the idea of having to: a) rely on an undocumented feature, and, b) manually keep track and maintain the timestamps of all the affected packages across several databases (e.g., development, test, and production).
    3. Put the package into a Reports library or into the report itself.
    This didn't work for me because Reports does not understand WITH clauses in PL/SQL. For example, with the example query in my previous post, I get an error like this:
    Error 103 at line {line defining name of factored subquery}, column {first column in line defining name of factored subquery}
    Encountered the symbol "SUB_QUERY" when expecting one of the following:
    &lt;a SQL statement&gt;
    4. Use an RDF file instead of a REP file.
    I didn't use this workaround because I wanted to protect the design of the report by using a REP file instead of an RDF file.
    So instead, I:
    1. Created a database package containing a pipelined function that returned the results of the WITH clause query that Reports did not "understand".
    2. Used an SQL query in my report of the form
    SELECT * FROM TABLE(MY_PACKAGE.MY_PIPELINED_FUNCTION(arg1, arg2, ...))
    I can drop and re-create the package and run the REP file against another database both without leading to the REP-8 error.

  • With clause and union

    any alternative solution for these kind of query? i have union in two with clause query but resulting error.
    below is a sample example.
      1   with x as (select distinct no from dbo.tt)
      2   select * from x
      3  union all
      4   with yy as (select distinct no from dbo.tt)
      5*  select * from yy
    SQL> /
    select * from yy
    ERROR at line 5:
    ORA-32034: unsupported use of WITH clause

    with x as (select distinct no from dbo.tt),
         yy as (select distinct no from dbo.tt)
    select * from x
    union all
    select * from yySY.

  • Oracle text - issue with contains query

    Hello,
    Need urgent help.
    Following code in my procedure is giving me error.
    TYPE c_1 is ref cursor;
    result_cursor c1;
    i_text2 := 'NEW%';
    open result_cursor for
    'select /*+ INDEX_SS_DESC(e cad_addr_idx2 )*/
    from cad_address
    where
    contains(text, {:i_text2}, 1) > 0
    and rec_type in (1,2,3,4)
    order by occur_count desc'
    using
    i_text2;
    ORA-00936: missing expression
    ORA-06512: at "AV_OWNER.MY_PROC", line 43
    ORA-06512: at line 6
    Oracle version is 11.2.0.3.0.
    Thanks,

    check your table is 'text indexed' on this 'Text' column.To knoow more about 'text index' go to
    http://docs.oracle.com/cd/B19306_01/text.102/b14217/ind.htm
    Also refer to the below thread where someone had faced issues with CONTAINS clause.
    ORA-20000: Oracle Text error: DRG-10599: column is not indexed

  • Bug in WITH clause (subquery factoring clause) in Oracle 11?

    I'm using WITH to perform a set comparison in order to qualify a given query as correct or incorrect regarding an existing solution. However, the query does not give the expected result - an empty set - when comparing the solution to itself in Oracle 11 whereas it does in Oracle 10. A minimal example os posted below as script. There are also some observations about changes to the tables or the query that make Oracle 11 returning correct results but in my opinion these changes must not change the semantics of the queries.
    Is this a bug or am I getting something wrong? The Oracle versions are mentioned in the script.
    -- Bug in WITH clause (subquery factoring clause)
    -- in Oracle Database 11g Enterprise Edition 11.2.0.1.0?
    DROP TABLE B PURGE;
    DROP TABLE K PURGE;
    DROP TABLE S PURGE;
    CREATE TABLE S (
         m     number NOT NULL,
         x     varchar2(30) NOT NULL
    CREATE TABLE K (
         k char(2) NOT NULL,
         x varchar2(50) NOT NULL
    CREATE TABLE B (
         m     number NOT NULL ,
         k char(2) NOT NULL ,
         n     number
    INSERT INTO S VALUES(1, 'h');
    INSERT INTO S VALUES(2, 'l');
    INSERT INTO S VALUES(3, 'm');
    INSERT INTO K VALUES('k1', 'd');
    INSERT INTO K VALUES('k2', 'i');
    INSERT INTO K VALUES('k3', 'm');
    INSERT INTO K VALUES('k4', 't');
    INSERT INTO K VALUES('k5', 't');
    INSERT INTO K VALUES('k6', 's');
    INSERT INTO B VALUES(1, 'k1', 40);
    INSERT INTO B VALUES(1, 'k2', 30);
    INSERT INTO B VALUES(1, 'k4', 50);
    INSERT INTO B VALUES(3, 'k1', 10);
    INSERT INTO B VALUES(3, 'k2', 20);
    INSERT INTO B VALUES(3, 'k1', 30);
    INSERT INTO B VALUES(3, 'k6', 90);
    COMMIT;
    ALTER TABLE S ADD CONSTRAINT S_pk PRIMARY KEY (m);
    ALTER TABLE K ADD CONSTRAINT K_pk PRIMARY KEY (k);
    ALTER TABLE B ADD CONSTRAINT B_S_fk
    FOREIGN KEY (m) REFERENCES S(m) ON DELETE CASCADE;
    CREATE OR REPLACE VIEW v AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC;
    -- Query 1: Result should be 0
    WITH q AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    SELECT COUNT(*)
    FROM
    SELECT * FROM q
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM q
    -- COUNT(*)
    -- 6
    -- 1 rows selected
    -- Query 2: Result set should be empty (Query 1 without counting)
    WITH q AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    SELECT *
    FROM
    SELECT * FROM q
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM q
    -- M N
    -- null 10
    -- null 30
    -- null 40
    -- 1 40
    -- 3 10
    -- 3 30
    -- 6 rows selected
    -- Observations:
    -- Incorrect results in Oracle Database 11g Enterprise Edition 11.2.0.1.0:
    -- Query 1 returns 6, Query 2 returns six rows.
    -- Correct in Oracle Database 10g Enterprise Edition 10.2.0.1.0.
    -- Correct without the foreign key.
    -- Correct if attribute x is renamed in S or K.
    -- Correct if attribute x is left out in S.
    -- Correct without the ORDER BY clause in the definition of q.
    -- Only two results if the primary key on K is left out.
    -- Correct without any change if not using WITH but subqueries (see below).
    -- Fixed queries
    -- Query 1b: Result should be 0
    SELECT COUNT(*)
    FROM
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    -- COUNT(*)
    -- 0
    -- 1 rows selected
    -- Query 2b: Result set shoud be empty (Query 1b without counting)
    SELECT *
    FROM
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    -- M N
    -- 0 rows selected

    You're all gonna love this one.....
    The WITH clause works. But not easily.
    Go ahead, build the query, (as noted in a recent thread, I, too, always use views), set the grants and make sure DISCOVERER and EULOWNER have SELECT privs.
    1. Log into Disco Admin as EULOWNER. Trust me.
    2. Add the view as a folder to the business area.
    3. Log into Disco Desktop as EULOWNER. Don't laugh. It gets better.
    4. Build the workbook and the worksheet (or just the worksheet if apropos)
    5. Set the appropriate "sharing" roles and such
    6. Save the workbook to the database.
    7. Save the workbook to your computer.
    8. Log out of Desktop.
    9. Log back into Desktop as whatever, whoever you usually are to work.
    10. elect "open existing workbook"
    11. Select icon for "open from my computer". See? I told you it would get better!
    12. Open the save .dis file from your computer.
    13. Save it to the database.
    14. Open a web browser and from there, you're on your own.
    Fortran in VMS. Much easier and faster. I'm convinced the proliferation of the web is a detriment to the world at large...On the other hand, I'm also waiting for the Dodgers to return to Brooklyn.

Maybe you are looking for

  • Camera RAW - freezing while editing image and also wont update to new version

    I moved from Mac 10.6.8 computer to a new Mac 10.10 computer. When I did, I transfer of all my files through data migration and it moved photoshop and bridge over for me without having to reinstall. Which was good because I do not have the disc anymo

  • Need mifi pocket hotspot for iPad mini.

    I am in need of a mifi pocket hotspot to use with a iPad wifi mini, there is so many to chose from. Anyone knows which one might work best, has any experience using one with thete iPad.

  • Fields Truncated when printing the report???

    I have this exemple in the monitor when I generted the module: " Meziane Noureddine 7, Rue de Geneve" But when I print this report it's like this : " Mezia Noureddin 7, Rue de Genev Why???? thanks lot

  • Case Insensitive Querys

    If I have a table that has a column called login_name defined as char(64). I currenrly prepare statments that look like: select something from some_table where login_name like ?; Can I use the following if I wanted to implement a case insensitive que

  • BB 8900 battery discharged, won't turn on, LED blinks 4 times, phone works with other battery

    Hi, battery of my BB fully discharged for first time since getting phone a few weeks ago  I plugged it into mains charger to charge it first there is red LED light then red LED started flashing 4 times light stopped a few seconds later 4 flashes agai