Put added 'WITH' in the statement Select possible?

Suppose I have an SQL statement such as:

with t1 in (select...),.
T2 in (select...)
Select... From t1, t2 Where...;

Can I merge somehow the prefixed 'by' expression in the actual select statement?

I remember there is a syntax to equivalent statement such as:

SELECT... from t1 in (select...), t2 in (select...) which the...;

but it does not work.

Peter

It will be like

Select...
From (select...) Of...) T1
(select... Of...) T2
WHERE THE...

Concerning
Arun

Tags: Database

Similar Questions

  • Convert NVARCHAR2 VARCHAR2 in the statement select

    I need to convert values select NVARCHAR2 VARCHAR2 in a statement. Is this possible? COUNTY_PARCEL_DATA columns are the columns NVARCHAR2 requiring a conversion. I tried to TRANSLATE (COUNTY_PARCEL_DATA. WITH THE HELP OF CHAR_CS SITUS_STREET_NUMBER), CAST (COUNTY_PARCEL_DATA. SITUS_STREET_NUMBER AS VARCHAR2 (100)), CONVERTCS (COUNTY_PARCEL_DATA. SITUS_STREET_NUMBER, "CHAR_CS") and others directly in the statement for each column. All that I'm missing? Thank you.

    SELECT BENEFICIARY.NAME_FIRST. ' ' || BENEFICIARY.NAME_LAST AS THE NAME,
    COUNTY_PARCEL_DATA. SITUS_STREET_NUMBER
    || ' '
    || COUNTY_PARCEL_DATA. SITUS_STREET_DIRECTION
    || ' '
    || COUNTY_PARCEL_DATA. SITUS_STREET_NAME
    || ' '
    || COUNTY_PARCEL_DATA. SITUS_STREET_TYPE
    AS AN ADDRESS.
    COUNTY_PARCEL_DATA. CITY OF SITUS_CITY AS,
    "AZ" AS THE STATE,
    COUNTY_PARCEL_DATA. ZIP SITUS_ZIP AS,
    "T4" AS TRACER
    OF BENEFICIARY
    LEFT OUTER JOIN
    VARS_PARCEL
    RECIPIENT OF ONTARIO. AVNUM = VARS_PARCEL. AVNUM
    LEFT OUTER JOIN
    COUNTY_PARCEL_DATA
    ON VARS_PARCEL. APN = COUNTY_PARCEL_DATA. AFN
    LEFT OUTER JOIN
    OWNER
    RECIPIENT OF ONTARIO. BENEFICIARY_ID = OWNER. BENEFICIARY_ID
    WHERE (SUBSTR (VARS_PARCEL. AVNUM, 0, 4) IN
    (SELECT COLUMN_VALUE
    TABLE (SPLIT_STRING)
    R_VARS_MAILING_NOTICES. NEIGHBORHOODS
    )))
    OR R_VARS_MAILING_NOTICES. NEIGHBORHOODS IS NULL)
    AND THE BENEFICIARY. BENEFICIARY_TYPE = 'tenant ';

    Edited by: Guddie April 6, 2010 12:23

    You do the VARCHAR2 NVARCHAR2 conversions, see comments below

    SELECT BENEFICIARY.NAME_FIRST || ' ' || BENEFICIARY.NAME_LAST AS NAME,
    COUNTY_PARCEL_DATA.SITUS_STREET_NUMBER                        <==== Here, obviously
    || ' '
    || COUNTY_PARCEL_DATA.SITUS_STREET_DIRECTION                <==== Here
    || ' '
    || COUNTY_PARCEL_DATA.SITUS_STREET_NAME                        <==== Here
    || ' '
    || COUNTY_PARCEL_DATA.SITUS_STREET_TYPE                        <==== Here
    AS ADDRESS,
    COUNTY_PARCEL_DATA.SITUS_CITY AS CITY,                            <==== Here
    'AZ' AS STATE,
    COUNTY_PARCEL_DATA.SITUS_ZIP AS ZIP,                                 <==== Here
    'T4' AS TRACER
    FROM BENEFICIARY
    LEFT OUTER JOIN
    VARS_PARCEL
    ON BENEFICIARY.AVNUM = VARS_PARCEL.AVNUM
    LEFT OUTER JOIN
    COUNTY_PARCEL_DATA
    ON VARS_PARCEL.APN = COUNTY_PARCEL_DATA.APN                   <==== Here, maybe not so obvious
    LEFT OUTER JOIN
    OWNER
    ON BENEFICIARY.BENEFICIARY_ID = OWNER.BENEFICIARY_ID
    WHERE (SUBSTR (VARS_PARCEL.AVNUM, 0, 4) IN
    (SELECT COLUMN_VALUE
    FROM TABLE(SPLIT_STRING (
    R_VARS_MAILING_NOTICES.NEIGHBORHOODS
    )))
    OR R_VARS_MAILING_NOTICES.NEIGHBORHOODS IS NULL)
    AND BENEFICIARY.BENEFICIARY_TYPE = 'Tenant';
    

    This assumes that all fields of COUNTY_PARCEL_DATA are NVARCHAR2.

    Published by: AlanWms on April 6, 2010 15:53 changed 'joins' to 'conversions' in the 1st sentence.

  • a drawing space on a simple IF statement with the statement Select

    Hello

    I'm writing an IF statements as such

    Val1 IF (select x from tbla) then
    to do this
    on the other
    do this
    end if ';

    Is it possible to have a select line on the IF condition?

    Version 11.1.0.7

    The Gunners wrote:
    Hello

    I'm writing an IF statements as such

    Val1 IF (select x from tbla) then
    to do this
    on the other
    do this
    end if ';

    Is it possible to have a select line on the IF condition?

    Version 11.1.0.7

    No, but you can do something like that as easily.

    declare
       l_count  number(1);
    begin
    
       select
          count(*)
       into
          l_count
       from
          dual
       where exists
       (
          select
             null
          from
             table_name
          where col_name = val
       );
    
       if l_count > 0
       then
          ....
       else
          ...
       end if;
    
    end;
    /
    
  • problem with the statement select

    I want to view records that start with the letter D for a particular ID of a table called THE. To do this, I wrote the select statement with as operator.but when duplicates were found in the table it would not display. for eaxample
    create table tea(id number(40),f_name varchar2(150));
    
    INSERT INTO tea ( ID, F_NAME ) VALUES ( 
    832, 'Magnolia St. #12'); 
    INSERT INTO tea ( ID, F_NAME ) VALUES ( 
    832, 'Magnolia St. #10'); 
    INSERT INTO tea ( ID, F_NAME ) VALUES ( 
    1909, ' Delaware Ave.'); 
    INSERT INTO tea ( ID, F_NAME ) VALUES ( 
    1909, 'Delaware St.'); 
    INSERT INTO tea ( ID, F_NAME ) VALUES ( 
    832, 'Mangolia'); 
    INSERT INTO tea ( ID, F_NAME ) VALUES ( 
    832, 'Monolia'); 
    INSERT INTO tea ( ID, F_NAME ) VALUES ( 
    1909, 'Delaware'); 
    INSERT INTO tea ( ID, F_NAME ) VALUES ( 
    1909, 'Mandea'); 
    commit;
    
    select * from tea order by id;
    
        ID F_NAME
    ------ ------------------------------
       832 Magnolia St. #12
       832 Magnolia St. #10
       832 Mangolia
       832 Monolia
      1909  Delaware Ave.
      1909 Delaware St.
      1909 Delaware
      1909 Mandea
    
     now when i try with letter 'M' for 832 it is displaying the all the records starting with M
    select f_name from tea where upper(f_name) like upper('m%') and id=832;
    
    F_NAME
    ----------------------------
    Magnolia St. #12
    Magnolia St. #10
    Mangolia
    Monolia
    
    but when i tried with D it is not displaying  Delaware Ave.
    
    select f_name from tea where upper(f_name) like upper('d%') and id=1909;
    
    F_NAME
    -------------
    Delaware St.
    Delaware
    I'm unable to display folder Delaware Ave. , for the id of 1909. I need display this folder also.
    What could be the reason it is display for "M" and showing not "d".
    any suggestions please?
    I use 9i

    Because there is a space character before Delaware Ave
    Watch your insert statement

    INSERT INTO tea ( ID, F_NAME ) VALUES (
    1909, ' Delaware Ave.'); 
    

    To take

    INSERT INTO tea ( ID, F_NAME ) VALUES (
    1909, 'Delaware Ave.'); 
    

    And it should work

    - - - - - - - - - - - - - - - - - - - - -
    Kamran Agayev a. (10g OCP)
    http://kamranagayev.WordPress.com

  • support for the statement select

    Hi gurus,

    I have a table with orderentry and ordertype

    case 1:

    I want to get all of the files when ordertype = 1 times


    CASE2:

    I want to get the recordset when there is no ordertype = 1


    CREATE TABLE test
    (
    OrderEntry NUMBER,
    OrderType NUMBER
    );


    INSERT in the test
    values (10.1);

    INSERT INTO test
    VALUES (10, 2);

    INSERT INTO test
    VALUES (10, 1);

    INSERT INTO test
    VALUES (10, 2);

    INSERT INTO test
    VALUES (11: 1);

    INSERT INTO test
    VALUES (11, 2);

    INSERT INTO test
    VALUES (11, 2);

    INSERT INTO test
    VALUES (11, 2);

    INSERT INTO test
    VALUES (12: 1);

    INSERT INTO test
    VALUES (12: 1);

    INSERT INTO test
    VALUES (12, 2);

    INSERT INTO test
    VALUES (12, 2);

    INSERT INTO test
    VALUES (13: 2);

    INSERT INTO test
    VALUES (13: 2);

    INSERT INTO test
    VALUES (13: 2);

    COMMIT;

    I want the recordset when the ordertype 1 repeats

    my output should be:

    case 1:

    OrderEntry ordertype
    10 1
    2 of 10
    10 1
    2 of 10
    1 of 12
    1 of 12
    12 2
    12 2


    case 2:

    OrderEntry ordertype
    13 2
    13 2
    13 2


    Thanks in advance

    Hello

    Thanks for posting the instructions create table and sample data. I think that do you want

    --case 1
    SELECT
        orderentry,
        ordertype
    FROM
        (
            SELECT
                orderentry,
                ordertype,
                COUNT(CASE WHEN ordertype=1 THEN 1 END) OVER(PARTITION BY orderentry) ct
            FROM
                t_test
        )
    WHERE
        ct > 1
    /
    
    --case 2
    SELECT
        orderentry,
        ordertype
    FROM
        (
            SELECT
                orderentry,
                ordertype,
                COUNT(CASE WHEN ordertype=1 THEN 1 END) OVER(PARTITION BY orderentry) ct
            FROM
                t_test
        )
    WHERE
        ct = 0
    /
    
    DTYLER_APP@pssdev2> select * from t_test;
    
    ORDERENTRY  ORDERTYPE
    ---------- ----------
            10          1
            10          2
            10          1
            10          2
            11          1
            11          2
            11          2
            11          2
            12          1
            12          1
            12          2
            12          2
            13          2
            13          2
            13          2
    
    15 rows selected.
    
    DTYLER_APP@pssdev2> SELECT
      2      orderentry,
      3      ordertype
      4  FROM
      5      (
      6          SELECT
      7              orderentry,
      8              ordertype,
      9              COUNT(CASE WHEN ordertype=1 THEN 1 END) OVER(PARTITION BY orderentry) ct
     10          FROM
     11              t_test
     12      )
     13  WHERE
     14      ct > 1
     15  /
    
    ORDERENTRY  ORDERTYPE
    ---------- ----------
            10          1
            10          2
            10          1
            10          2
            12          1
            12          1
            12          2
            12          2
    
    8 rows selected.
    
    DTYLER_APP@pssdev2> SELECT
      2      orderentry,
      3      ordertype
      4  FROM
      5      (
      6          SELECT
      7              orderentry,
      8              ordertype,
      9              COUNT(CASE WHEN ordertype=1 THEN 1 END) OVER(PARTITION BY orderentry) ct
     10          FROM
     11              t_test
     12      )
     13  WHERE
     14      ct = 0
     15  /
    
    ORDERENTRY  ORDERTYPE
    ---------- ----------
            13          2
            13          2
            13          2
    
    3 rows selected.
    
  • I want to put my satellite to the State of origin - how?

    Please help I can't find any cd or dvd but to remove all the junk out of my laptop.
    How can I do? is the operating system on a separate part of the hard drive?

    I just want the laptop as if I just pulled it from the box.

    Thanks in advance for any assistance received

    Hello

    It would be very helpful if you could post your model mobile exact.

    If your computer is portable wasn t comes with CD or DVD I guess you can create yourself such a disc, but you can also use HARD drive recovery option but it depends on your laptop model:
    [How to recover a Toshiba notebook with the HDD recovery procedure? | http://forums.computers.toshiba-europe.com/forums/ann.jspa?annID=58]

  • Error code: 0x800CCC0F, your server suddenly put an end to the connection when sending emails with attachments

    Original title: send Inbox problems

    If I attach a pdf file to my outgoing mail, it lies in the Outbox and will not send then I get an error message, send e-mails with no attactments is no problem

    If you have your anti-virus value analyze them, disable the e-mail scanning.
    It is redundant and doesn't interfere with the transmission, especially with Windows
    Mail.
     
    --
    Dave N.
    MS - MVP (Mail)
    Windows 7 Ultimate 64
    "wynnieboy" wrote in message
    News: * e-mail address is removed from the privacy... *
     
    After my rarlier question if I add an attachment to an e-mail, it will be
    do not send and this is the error message
     
    Your server suddenly put an end to the connection. Possible for causes
    It include server problems, network problems, or a long period of
    inactivity. 'A last try', account: 'imap.aol.com', server:
    'smtp.aol.com', Protocol: SMTP, Port: 465, secure (SSL): Yes, Socket error:
    10053, error number: 0x800CCC0F
     
     

    Windows 7 Ultimate 64

  • Calling a function only when the State is active

    I turn to find the event just to call a function only when the status is active. In fact, I created a State to display the 'product details' click and once the system changes to this State - I have to perform a function.

    Here's the context:

    Let's say that you are on the home page where you will need to click on a product to see details. By clicking on the product, the State to view the details of the product will be activated and a variable inside the new state you will receive all the data (from the class of product). But I discovered Flex run all States at the beginning and we need to watch how declare our function to make sure that we do not have a null to a variable/object reference. Given that value is moving to the State only when the click event to occur, the process of globalization, execution of all States at the beginning will not have any value yet (for the specific product to deal with in the State of the productDetails). So I can't use creationComplete to perform a simple function like setSpecs(), where all the values (for example, width, height, circumference, diameter, price, etc.) will be instiate specific labels.

    What event to use to call a function internal once we are in the State? Just using the creationComplet and stated if he check the currentState = that I have to work on is not enough. I tried 'activate', 'show', 'enterStage' and many others, but without success. I tried to search the Internet, but it seems that this problem is not popular enough to generate sufficient results.

    But I know that it is possible in the case otherwise it will be is not logical and since Flex work very well with the event, I found the right event. It's something basic I know, but when you do not know, it seems difficult to find! ;-))

    Thanks Greg!

    I agree, this is a better method. So I'll change my SENSITIVITY to use viewStack instead of the State. But the problem persists what that, if we use the viewStack State to launch an event only when the State/viewStack is displayed on the screen.

    I found something that works very well for me: updateComplete.

    First of all, I found this before reading your information about viewStack so it worked very well for the method of the State. That I decided to do a test to viewStack and made the necessary changes to the code to reflect a viewStack navigation and make sure the updateComplete was not within my component (stateProduct.mxml). The system was not able to view the specification as the setSpecs() function was not instantiate when displayed. I added the updateComplete = "{setSpecs ()} ' and everything worked great!" So I conclude that no matter if you are using a viewStack State, the updateComplete event can be used to run or functions only when the component is displayed on the screen.

    Now, I have to make my transition between the State working with viewStack effect! ;-))

    Thanks to Greg for this useful tip!

  • When Lr automatically to update the State?

    Without manually copying the parameters put forward State by Ctrl + Shift + Alt + left or without putting a new before the State by right-clicking on one of the entries in the history, when Lr automatically updated the before State?

    If you are not manually adjust the "before" State, this State is defined once, just after the import, just after applying a preset so you have a preset selected in the import dialog box.

    Snapshots and virtual copies are extra...

  • clarification of the statement in the study of materials

    Here's the question:

    You set the pool return directive plan resources. SCOTT throws a batch which inserts millions of rows. Total cancellation the space allocated to the Group of users is outdated. One of the incorrect results is "BLAKE can start a transaction... after SCOTT ends with error"

    The statement in the explanation is that (when the undo pool resource is exhausted) other users cannot start DML to cancel the space used by the other sessions of the group is released. But it seems when SCOTT ends its session is canceled and cancel it used is released.

    What I'm missing here?

    Given Undo are not immediately released but can be stored in the undo tablespace, light of retention settings account Cancel:
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e16508/logical.htm#CNCPT1080

    Edited by: P. Forstmann on 19 Jan. 2011 19:04

  • function body pl/sql return SQL query - if with in the select statement

    Hi all

    I have a condition where, when the summary field is checked, only we see the this column for users in the report. IF statement is possible in this case? I gave the code below... is possible to write something like below, or y at - it another way to do it?

    \
    v_sql: = ' select TBLCASES. INVESTIGATOR as an INVESTIGATOR,';
    v_sql: = v_sql | "TBLCASES. CASENUMBER as CASENUMBER,';
    v_sql: = v_sql | "TBLCASES. OPENDATE as OPENDATE,';
    v_sql: = v_sql | "TBLCASES. ESTCOMPLETE as DATE_CIBLE,';
    v_sql: = v_sql | "TBLCASES. STATUS of STATUS ';
    v_sql: = v_sql | "TBLCASES. Case CODE case CODE as,';
    v_sql: = V_sql | "TBLCASES. FAIR_HOTLINE as FAIRHotline,';
    v_sql: = v_sql | "TBLCASES. NYSIG as NYSIGCase,';
    v_sql: = v_sql | "TBLCASES. The REGION';

    IF: P44_INCLUDE_SUMMARY_FIELD is not null THEN
    v_sql: = v_sql | "TBLCASES. SUMMARY,';
    END IF;

    v_sql: = v_sql | "TBLCASES. PROGAREA as PROGArea ';
    v_sql: = v_sql | ' from TBLCASES where 1 = 1';
    .. \

    Hi Lucie,.

    You are adding and removing a column in a report, so it may be useful to have the extra on the end of the query.
    You get an error? If so, paste it in...

    BUT - that I would put a condition on the column where ': P44_INCLUDE_SUMMARY_FIELD is not null '
    It under 'Attributes of the column' report select the change column icon, and there a breadcrumb "Condition."
    Select "In Expression 1 point value is not Null" and put the P44_INCLUDE_SUMMARY_FIELD in the Expression 1 text box.

    And I have to make it more readable like that when I do the dynamic SQL code:
    IF: P44_INCLUDE_SUMMARY_FIELD is not null THEN
    v_INCLUDE_SUMMARY_FIELD: = ' TBLCASES. SUMMARY summary ';
    END IF;

    v_sql: = ' select TBLCASES. RESEARCHER, researcher,
    TBLCASES. CASENUMBER as CASENUMBER
    TBLCASES. OPENDATE as OPENDATE,
    TBLCASES. ESTCOMPLETE as DATE_CIBLE,
    TBLCASES. STATUS of STATUS,
    TBLCASES. Case CODE case CODE as,
    TBLCASES. FAIR_HOTLINE as FAIRHotline,
    TBLCASES. NYSIG as NYSIGCase,
    TBLCASES. REGION as the region,
    TBLCASES. PROGAREA as PROGArea,' |
    v_INCLUDE_SUMMARY_FIELD |
    ' from TBLCASES where 1 = 1; ';

    It will be useful,
    BRITISH COLUMBIA

  • Possible to get the handle to the line added with::AddRow()

    I need set default values for newly added lines in tabular form, based on some other page elements, hidden. Unfortunately, like many other elements APEX incredibly useful, addRows seems to be completely undocumented. So, I hope someone here can tell me how to get a reference to each newly added line.

    I am able to replace the functionality of 'javascript:addRow()' by default with my own dynamic Action triggered by clicking on the button Add a line.
    alert('Chicken or Egg?');
    var newRow = addRow();
    newRow doesn't seem to provide a reference to a valid object. I say this because "alert (typeof newRow)' returns"undefined ".

    How can I get a reference to each newly added line? Yes, I know that I can walk the apex_application.g_f0* collections, but it just seems like this could be done directly in the same javascript block where the line has been added.

    Someone has ideas how I could expand the foregoing to define two columns to default values?

    Thank you

    -Joe

    Published by: Joe Upshaw on March 15, 2012 15:19

    Hello

    name = "f03" assumes that the column is the same as that which is located in apex_application.g_f03, correct?

    It's true.

    Fact the ': last "automatically find the last row.

    It's true. The last input field with the same name.

    The default value that I need to get is a hidden page element.

    If the default value is the session to the State of an item, you can use the attributes in a table, by default type (name of the application or page element) element to set the default value for the form. Then you don't need dynamic action. To get the value of the element the page use $v ('PAGE_ITEM_NAME').

    Rod West

  • Problem adding values to a table with the state machine architecture

    Hello

    I currently have a problem that I have to build a program using state machine architecture and now I want to add a value in a table whenever you press a button, but I would like the table to add the new value, rather than deleting the last value. I can't seem to figure out how to make this work without using while loops and similar. It doesn't seem to work properly.

    It is in the case of measurement.

    The idea is I draw several lines then it records the length of the lines in a table and then I'll take one average this so I can convert pixels into real life SO units. But right now I can't seem to add the information in the table.

    There is a little screw Sub, but I think that they should not be important for this question please!

    What's the problem with just the table help build?

  • Shouldn't be using WITH return the same results as if you would first put the results in a table?

    First of all, here is my version info:

    BANNER

    --------------------------------------------------------------------------------

    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

    PL/SQL Release 11.1.0.7.0 - Production

    CORE Production 11.1.0.7.0

    AMT for HP - UX: 11.1.0.7.0 - Production Version

    NLSRTL Version 11.1.0.7.0 - Production

    I just re-read the documentation of the subquery factoring clause of select again and I saw no restriction that applies.

    Can someone help me understand why I get different results?  I would like to be able to use the statement that creates spades3, but for some reason it does not work.  However, when I break up and store the last subquery TMP in a table (MAT1), I am able to get the expected results in MAT2.

    Sorry if the example seems a bit esoteric.  I tried to put something together to help illustrate another problem, so it was more convenient to use the same instructions to illustrate this problem.

    drop table mat1;
    create table mat1 as
    with skus as (
      select level as sku_id
      from dual
      connect by level <= 1000
      ),
      tran_dates as (
      select to_date('20130731', 'yyyymmdd') + level as tran_date
      from dual
      connect by level <= 31
      ),
      sku_dates as (
      select s.sku_id,
      t.tran_date,
      case when dbms_random.value * 5 < 4
      then 0
      else 1
      end as has_changes,
      round(dbms_random.value * 10000, 2) as unit_cost
      from skus s
      inner join tran_dates t
      on 1 = 1
      )
    select d.sku_id,
      d.tran_date,
      d.unit_cost
      from sku_dates d
      where d.has_changes = 1
    ;
    
    
    drop table mat2;
    create table mat2 as
    select m.sku_id,
      m.tran_date,
      m.unit_cost,
      min(m.tran_date) over (partition by m.sku_id order by m.tran_date rows between 1 following and 1 following) as next_tran_date
      from mat1 m
    ;
    
    
    drop table mat3;
    create table mat3 as
    with skus as (
      select level as sku_id
      from dual
      connect by level <= 1000
      ),
      tran_dates as (
      select to_date('20130731', 'yyyymmdd') + level as tran_date
      from dual
      connect by level <= 31
      ),
      sku_dates as (
      select s.sku_id,
      t.tran_date,
      case when dbms_random.value * 5 < 4
      then 0
      else 1
      end as has_changes,
      round(dbms_random.value * 10000, 2) as unit_cost
      from skus s
      inner join tran_dates t
      on 1 = 1
      ),
      tmp as (
      select d.sku_id,
      d.tran_date,
      d.unit_cost
      from sku_dates d
      where d.has_changes = 1
      )
    select m.sku_id,
      m.tran_date,
      m.unit_cost,
      min(m.tran_date) over (partition by m.sku_id order by m.tran_date rows between 1 following and 1 following) as next_tran_date
      from tmp m
    ;
    
    
    select count(*) from mat2;
    select count(*) from mat3;
    
    
      from tmp m
    ;
    

    select count(*) from mat2;
    select count(*) from mat3;
    

    Select count (*) from mat2;

    COUNT (*)

    ----------

    31000

    Executed in 0,046 seconds

    Select count (*) in spades3;

    COUNT (*)

    ----------

    0

    Executed by 0,031 seconds

    Hello

    Khaled says:

    The problem is with

    -case when dbms_random.value * 5<>

    You can change this

    dbms_random. Value (1,100) * 5<>

    and test

    I don't know that I agree 100% with your police department, work there.

    dbms_random. Value, no arguments, returns a random number between 0 (inclusive) and 1 (exclusive), so

    dbms_random. Value * 5< 4 ="" will="" be="" true="" about="" 80%="" of="" the="">

    dbms_randon. Value (1, 100) returns a random number between 1 (included) and 100 (exclusive), so

    dbms_random. Value (1, 100) * 5< 4="" will="" be="" true="" exactly="" 0%="" of="" the="" time,="" which="" is="" not="" what="" op="" wants="" at="">

    The problem here apparently revolves around the optimizer not really call dbms_random over and over again in sku_dates of the subquery.  Add ROWNUM in the subquery seems to force Oracle to assess dbms_random.value immediately.  I don't really understand myself, but adding 1 element in the SELECT of the sku_dates subquery clause could solve the problem:

    create table spades3 as

    with references like)

    Select the level as sku_id

    of the double

    connect by level<=>

    ),

    tran_dates like)

    Select the level + to_date ('20130731', 'YYYYMMDD') as tran_date

    of the double

    connect by level<=>

    ),

    sku_dates like)

    Select s.sku_id,

    t.tran_date,

    -case when dbms_random.value * 5<>

    then 0

    1 other

    end as has_changes,

    Round (dbms_random.value * 10000, 2) as unit_cost

    ROWNUM AS r-<=== new="" column="" added="" here="" new="" column="" added="">

    s SKUs

    inner join tran_dates t

    1 = 1

    ),

    tmp as)

    Select d.sku_id,

    d.tran_date,

    d.unit_cost

    of sku_dates d

    where d.has_changes = 1

    )

    Select m.sku_id,

    m.tran_date,

    m.unit_cost,

    min (m.tran_date) over (partition by order of m.sku_id by m.tran_date rows between 1 next and 1 suite) as next_tran_date

    of tmp m

    ;

    You do not have to refer to this column anywhere; just having him in the subquery is enough.

    If someone can't understand why, I know it.

  • ListField interferes with the State

    So I have a listfield on the bottom of my screen and a status which is a toolbar that I did.

    I have the earpiece to the listfield:

    protected boolean touchEvent(TouchEvent event) {
            int x = event.getX(1);
            int y = event.getY(1);
            if (event.getEvent() == TouchEvent.CLICK && done == true) {
                // Check if a list item is selected.
                if (lf.getSelectedIndex() > -1 && lf.getExtent().contains(x, y)) {
                    _uiapp.pushScreen(new SearchInfoScreen());           }
            }
            else {
                return false;
            }
            return true;
        }
    

    However, when I click on the status (toolbar in the State), it goes to the screen to search for information. Can someone tell me a possible solution?

    Had a problem with the earpiece of the toolbar.

Maybe you are looking for