Creating lines in select query

Hello
I have a column in my query that controls the number of times where the rank must be returned by the query.
For example
with the trial as
(select 'abc' as col1, '123' as col2, 1 as the double numtimes
UNION ALL
Select 'def' as col1, "456" as col2, 2 as numtimes from dual
UNION ALL
Select "ghi" as col1, '789' as col2, 3 as the double numtimes
)
Select * from test

which returns
COL1 COL2 NUMTIMES

ABC 123 1
def 2 456
IGS 3 789


Now I want the second row returned 2 times and the third row 3 times (based on numtimes)

Is there a SQL way to do...

Any help would be really appreciated

Try:

SQL> with test as
  2  ( select 'abc' as col1 , '123' as col2 , 1 as numtimes from dual
  3  UNION ALL
  4  select 'def' as col1 , '456' as col2 , 2 as numtimes from dual
  5  UNION ALL
  6  select 'ghi' as col1 , '789' as col2 , 3 as numtimes from dual
  7  )
  8  select *
  9  from   test
 10  connect by level <= numtimes
 11         and col1 = prior col1
 12         and prior dbms_random.value is not null;

COL COL   NUMTIMES
--- --- ----------
abc 123          1
def 456          2
def 456          2
ghi 789          3
ghi 789          3
ghi 789          3

6 rows selected.

Tags: Database

Similar Questions

  • Help of the complex select query (Group by)

    Hello
    I am in need of your help to create a unique select query for the data in the table below and whose output requies. I use oracle 10g on RHEL 5 version.

    create table bustour (number of bussno (4), start_date date, number (2)) passenger;
    ALTER session set nls_date_format = "dd-mm-yyyy";
    insert into bustour values (4123, April 10, 2009 ", 20);
    insert into bustour values (4123, may 10, 2009 ", 25);
    insert into bustour values (4123, may 10, 2009 ', 18);
    insert into bustour values (4123, June 10, 2009 ', 15);

    insert into bustour values (6138, March 10, 2009 ', 16);
    insert into bustour values (' 6138, March 10, 2009 ", 19);
    insert into bustour values (6138, April 10, 2009 ', 22);
    insert into bustour values (' 6138, April 10, 2009 ", 13);

    insert into bustour values ("4123, July 10, 2009 ', 23);
    insert into bustour values (4123, August 10, 2009 ", 27);
    insert into bustour values (4123, November 10, 2009 ', 15);

    insert into bustour values (6138, may 10, 2009 ', 16);
    insert into bustour values (6138, may 10, 2009 ', 13);
    insert into bustour values (6138, may 10, 2009 ', 18);
    insert into bustour values (' 6138, may 10, 2009 ", 24);
    insert into bustour values (6138, July 10, 2009 ", 20);
    insert into bustour values (6138, August 10, 2009 ", 18);
    SQL> select * from bustour;
    
        BUSSNO START_DATE PASSENGERS
    ---------- ---------- ----------
          4123 04-10-2009         20
          4123 05-10-2009         25
          4123 05-10-2009         18
          4123 06-10-2009         15
          6138 03-10-2009         16
          6138 03-10-2009         19
          6138 04-10-2009         22
          6138 04-10-2009         13
          4123 07-10-2009         23
          4123 08-10-2009         27
          4123 11-10-2009         15
    
        BUSSNO START_DATE PASSENGERS
    ---------- ---------- ----------
          6138 05-10-2009         16
          6138 05-10-2009         13
          6138 05-10-2009         18
          6138 05-10-2009         24
          6138 07-10-2009         20
          6138 08-10-2009         18
    
    17 rows selected.
    
    I want query output as below :
    
    Bussno  start_date      end_Date   totalpassengers   maxpessenger  maxpassdate
    4123    04-10-09        06-10-09          78              25         05-10-09
    6138    03-10-09        04-10-09          70              22         04-10-09 
    4123    07-10-09        11-10-09          65              27         08-10-09
    6138    05-10-09        08-10-09         109              24         05-10-09
    So that we can know on what particular travel calendar, we have obtained maximum passengers and the date. (For calculating % of bonus driver)

    Please help me to write the query.

    Best regards
    Nisha

    OK, something like this:

    with my_tab as (select 1 id, 4123 busno, to_date('04/10/2009', 'dd/mm/yyyy') start_date, 20 passengers from dual union all
                    select 2 id, 4123 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 25 passengers from dual union all
                    select 3 id, 4123 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 18 passengers from dual union all
                    select 4 id, 4123 busno, to_date('06/10/2009', 'dd/mm/yyyy') start_date, 15 passengers from dual union all
                    select 5 id, 6138 busno, to_date('03/10/2009', 'dd/mm/yyyy') start_date, 16 passengers from dual union all
                    select 6 id, 6138 busno, to_date('03/10/2009', 'dd/mm/yyyy') start_date, 19 passengers from dual union all
                    select 7 id, 6138 busno, to_date('04/10/2009', 'dd/mm/yyyy') start_date, 22 passengers from dual union all
                    select 8 id, 6138 busno, to_date('04/10/2009', 'dd/mm/yyyy') start_date, 13 passengers from dual union all
                    select 9 id, 4123 busno, to_date('07/10/2009', 'dd/mm/yyyy') start_date, 23 passengers from dual union all
                    select 10 id, 4123 busno, to_date('08/10/2009', 'dd/mm/yyyy') start_date, 27 passengers from dual union all
                    select 11 id, 4123 busno, to_date('11/10/2009', 'dd/mm/yyyy') start_date, 15 passengers from dual union all
                    select 12 id, 6138 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 16 passengers from dual union all
                    select 13 id, 6138 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 13 passengers from dual union all
                    select 14 id, 6138 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 18 passengers from dual union all
                    select 15 id, 6138 busno, to_date('05/10/2009', 'dd/mm/yyyy') start_date, 24 passengers from dual union all
                    select 16 id, 6138 busno, to_date('07/10/2009', 'dd/mm/yyyy') start_date, 20 passengers from dual union all
                    select 17 id, 6138 busno, to_date('08/10/2009', 'dd/mm/yyyy') start_date, 18 passengers from dual)
    -- end of mimicking your data; use SQL below:
    select busno,
           min(start_date) start_date,
           max(start_date) end_date,
           sum(passengers) total_passengers,
           max(passengers) max_passengers,
           max_pass_date
    from   (select id,
                   start_date,
                   busno,
                   passengers,
                   distance,
                   max(start_date) keep (dense_rank first order by passengers desc) over (partition by distance, busno) max_pass_date
            from   (select id,
                           start_date,
                           busno,
                           passengers,
                           -- using tabibitosan method, borrowed from Aketi Jyuuzou
                           dense_rank() over (order by id) -
                              row_number() over (partition by busno order by id) distance
                    from   my_tab))
    group by busno, distance, max_pass_date
    order by min(id)
    
         BUSNO START_DATE END_DATE   TOTAL_PASSENGERS MAX_PASSENGERS MAX_PASS_DATE
    ---------- ---------- ---------- ---------------- -------------- -------------
          4123 04/10/2009 06/10/2009               78             25 05/10/2009
          6138 03/10/2009 04/10/2009               70             22 04/10/2009
          4123 07/10/2009 11/10/2009               65             27 08/10/2009
          6138 05/10/2009 08/10/2009              109             24 05/10/2009   
    
  • What is the syntax for creating a global temporary table using a select query

    HII
    I create a global temporary table using a select query... How to speak of "on commit preserve rows ' who?


    create a table temporary global t1 select * from trn_ordbase on the lines of commit preserve;

    but this is an invalid syntax, then how to talk on commit preserve rows in this? If I don't mention, by default its recital on the validation of deleted rows.

    Please help me on this problem.
    create global temporary table t1 on commit preserve rows
      2  as select * from dual;
    
    Table created.
    
    TUBBY_TUBBZ?
    
  • Select and validate the newly created lines (data stop) in ADF

    Hi all

    Here's the problem of mine: I want to validate and save the data in the SERIAL_EXCHANGE table, include NEW_SERIAL_NO and OLD_SERIAL_NO. The OLD_SERIAL_NO is not allowed to save in 2 files, I used the getCurrentRow method to select the new created line and validate it. This method works when I do not change the selected line and create other rows consecutively. But when I do, the method does not work well.

    So I want to find a way to select newly created lines and validate their value before they are committed to the database. Please help if you have an idea how to solve.

    Thank you
    VnMa

    This in the right place - DB

    unique index on the old serial number
    foreign key to validate the existence of the old serial number of the other table

    In the ADF, you would use a unique key for the uniqueness and association EO to validate the existence of the other table.

  • place a select query calculation in a different column in the same table

    How can I put my calculation result in a column named within the same table?

    I have a table called: dgpercentagedatachart

    I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage

    In the query, I gave the result the Alias of the cal

    What I want is to put this result in my application or my calculation (in percentage) in my column "percent" on my table of dgpercentagedatachart vacuum.

    How can I configure this syntax?

    This is the select query, I came with:

    Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.

    100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal

    of dgpercentagedatachart;

    Here are the results:

    CAL lowestfeederrating Totalcecrating

    8,978 7.48166666666666666666666666666666666667 120

    30.951 25.7925 120

    5.04                         120                          4.2

    Hello

    2685870 wrote:

    How can I put my calculation result in a column named within the same table?

    I have a table called: dgpercentagedatachart

    I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage

    In the query, I gave the result the Alias of the cal

    What I want is to put this result in my application or my calculation (in percentage) in my empty column '%' on my table of dgpercentagedatachart .

    How can I configure this syntax?

    This is the select query, I came with:

    Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.

    100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal

    of dgpercentagedatachart;

    Here are the results:

    CAL lowestfeederrating Totalcecrating

    8,978 7.48166666666666666666666666666666666667 120

    30.951 25.7925 120

    5.04                         120                          4.2

    To change an existing column in a table, you can use the UPDATE or MERGE, instructions like this:

    UPDATE dgpercentagedatachart

    Percentage of VALUE = 100,00 * totalcecrating

    / lowestfeederrating

    ;

    Noramlly, tables is not redundant columns like this.  If percent can always be calculated from other columns, then it is probably better to calculate at run time and store it in the database, where you will have to be updated each time the columns it depends on change.  You can use a view to avoid having to encode them the calculation.

    If you really don't want a column that can be calculated in the same lines other columns, then use a virtual column (if you use Oracle 11 or higher).

    I hope that answers your question.

    If this isn't the case, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.

    If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

  • How can I create a checkbox Select any type

    Hi all

    I have a vo where a transient attribute marked type boolean (index UI checkbox). I created

    ADF table which is used as vo. now, I created a check box and you want to when the user select this checkbox
    all marked lines field select checkbox (true).

    I try after the code, but there is a problem.

    JSF page code-
        <af:table value="#{bindings.AdAgcrlimitAppMView3.collectionModel}" var="row"
                        rows="#{bindings.AdAgcrlimitAppMView3.rangeSize}"
                        emptyText="#{bindings.AdAgcrlimitAppMView3.viewable ? 'No data to display.' : 'Access Denied.'}"
                        fetchSize="#{bindings.AdAgcrlimitAppMView3.rangeSize}" rowBandingInterval="0"
                        selectionListener="#{bindings.AdAgcrlimitAppMView3.collectionModel.makeCurrent}"
                        rowSelection="multiple" id="t1" inlineStyle="height:200px; width:790px;">
                <af:column sortProperty="#{bindings.AdAgcrlimitAppMView3.hints.Marked.name}" sortable="false"
                           id="c1" width="15">
                           
                            <f:facet name="header">
                  <af:panelGroupLayout id="pgl13">
                      <af:selectBooleanCheckbox  id="sbc2" autoSubmit="true" value="#{backing_Agency_Cr_Limit_Approval.selectAll}"/>
                    </af:panelGroupLayout>
                </f:facet>
                  <af:selectBooleanCheckbox autoSubmit="true" value="#{row.bindings.Marked.inputValue}" label="#{row.bindings.Marked.label}"
                                            shortDesc="#{bindings.AdAgcrlimitAppMView3.hints.Marked.tooltip}" id="sbc1" />
                </af:column>
    Backing bean code-
    private boolean selectAll;
    
    
        public void setSelectAll(boolean selectAll) {
            
            if (selectAll) {
                ViewObject vv=AdUtility.getView("AdAgcrlimitAppMView3Iterator");
                while(vv.hasNext())
                {
                    Row r=vv.next();
              
                    r.setAttribute("Marked","true");
                    System.out.println("Value of Approve Remark========>>>>>>>>>>"+r.getAttribute("ApproveRemark"));
                    }
                vv.executeQuery();
                }
            this.selectAll = selectAll;
        }
    
        public boolean isSelectAll() {
            
           
            return selectAll;
        }

    executeQuery is necessary when certain changes in query criteria. In this case you simply update of attributes of line, and you don't need to re-run the query. The re-run must be reset the value of the temporary variable for the lines to false. I guess earlier by selecting only selectAll selectAll case was getting checked and boxes for all the lines became not controlled, no?

  • Pass by using the line for my query

    HII,
    My kt_no field contains the following value;
    454654654,57687464654654, 36546461

    I wrote neck-of-line query like this;
    select substr (str,
                     instr (str, ',', 1, level  ) + 1,
                     instr (str, ',', 1, level+1) - instr (str, ',', 1, level) -1 ) str
      from (select  ','||kt_no||',' str from ptxn
            where txn_no=4)
      connect by level <= length(str)-length(replace(str,'/',''))-1;
    STR
    -------------
    454654654

    returning only the first value, where as I need output like this

    STR
    -------------
    454654654
    57687464654654
    36546461

    There may be white space before and after the decimal point in the chain.

    Please suggest the correction.

    TYVM

    Try:

    SQL> insert into ptxn (txn_no, t_names)
      2  select 4, 'Simon Peter, Alfred ,Moses , Miss Sameera
      3  Master Allen, Alphonso'
      4  from dual;
    
    1 row created.
    
    SQL> select txn_no
      2  ,      trim(regexp_substr(str, '[^,]+',1, level)) str
      3  from ( select txn_no
      4          ,     replace(t_names, chr(10), ',') str
      5          from  ptxn
      6       )
      7  connect by level <= length(str)-length(replace(str,','))+1
      8         and txn_no = prior txn_no
      9         and prior sys_guid() is not null;
    
        TXN_NO STR
    ---------- -------------------------
             4 Simon Peter
             4 Alfred
             4 Moses
             4 Miss Sameera
             4 Master Allen
             4 Alphonso
    
    6 rows selected.
    
  • The select query-based search page...

    I want to create a basic search page at the base on a select query.

    The select query will not be based on Table.Its based on functions.

    I created a view like this object

    Select xx_test_accruals(:p_date) of ACCUMULATION: p_date double DT

    I created a search page

    In the area of provision of Home Page, I added a region of the query. In this region of request I created a result based research Table.

    When I run the page opens with the field

    DT

    When I get back the date and click go, I get the error message like this...

    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: 27122 Houston: SQL error in the preparation of the statement. Statement: SELECT * FROM (select xx_test_accruals(:p_date) of ACCUMULATION: p_date double DT) QRSLT WHERE ((UPPER (DT) like: 1 AND (DT as: 2 OR DT as: 3 OR DT as: 4 OR DT as: 5)))



    Help, please

    Published by: [email protected] on October 4, 2009 14:04

    Hello

    I tried it on my machine... There is a little change on the approach.

    See we have a display object: XxAccrualsSummaryVO

    the query is

    Select xx_test_accruals (to_date (: 1, 'YYYY-MM-DD')) DT ACCRUAL, double to_date(:2,'YYYY-MM-DD')

    Create a view property object: say DateTestPVO and create a transitional DATE type attribute say dated. MinValue. How to create the View Object(read in dev guide) property.

    Link the date to DateTestPVO text entry and the date attribute. MinValue.

    Now that the page will load in process request initialize the PVO not XxAccrualsSummaryVO.

    Public Sub initialisePVO()
    {

    OAViewObject vo = (OAViewObject) getDatePVO1 ();
    If (! vo.isPreparedForExecution ())
    {
    vo.setMaxFetchSize (0);
    }
    Line = vo.createRow ();
    vo.insertRow (row);
    row.setNewRowState (Row.STATUS_INITIALIZED);

    }

    And when you press the Go button and then enter the date entered and set the location where the XxAccrualsSummaryVO clause.

    If (PageContext.GetParameter ("Go")! = null)
    {
    Get the value entered by the user in the date field.

    DateField OAMessageDateFieldBean = (OAMessageDateFieldBean) webBean.findIndexedChildRecursive ("text");
    String datetest = (String) dateField.getValue (pageContext) m:System.NET.SocketAddress.ToString ();
    Now set the where clause VO settings.
    OAViewObject vodate = (OAViewObject) am.findViewObject ("invoicetestVO1");
    vodate.setWhereClauseParams (null);
    vodate.setWhereClauseParam(0,datetest);
    vodate.setWhereClauseParam(1,datetest);
    vodate.executeQuery ();
    }

    It works perfectly... I tested it.

    Thank you
    Gerard

  • How to optimize the select query executed in a cursor for loop?

    Hi friends,

    I run the code below and clocked at the same time for each line of code using DBMS_PROFILER.
    CREATE OR REPLACE PROCEDURE TEST
    AS
       p_file_id              NUMBER                                   := 151;
       v_shipper_ind          ah_item.shipper_ind%TYPE;
       v_sales_reserve_ind    ah_item.special_sales_reserve_ind%TYPE;
       v_location_indicator   ah_item.exe_location_ind%TYPE;
    
       CURSOR activity_c
       IS
          SELECT *
            FROM ah_activity_internal
           WHERE status_id = 30
             AND file_id = p_file_id;
    BEGIN
       DBMS_PROFILER.start_profiler ('TEST');
    
       FOR rec IN activity_c
       LOOP
          SELECT DISTINCT shipper_ind, special_sales_reserve_ind, exe_location_ind
                     INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
                     FROM ah_item --464000 rows in this table
                    WHERE item_id_edw IN (
                             SELECT item_id_edw
                               FROM ah_item_xref --700000 rows in this table
                              WHERE item_code_cust = rec.item_code_cust
                                AND facility_num IN (
                                       SELECT facility_code
                                         FROM ah_chain_div_facility --17 rows in this table
                                        WHERE chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
                                          AND div_id = (SELECT div_id
                                                          FROM ah_div --8 rows in this table 
                                                         WHERE division = rec.division)));
       END LOOP;
    
       DBMS_PROFILER.stop_profiler;
    EXCEPTION
       WHEN NO_DATA_FOUND
       THEN
          NULL;
       WHEN TOO_MANY_ROWS
       THEN
          NULL;
    END TEST;
    The SELECT inside the LOOP FOR cursor query took 773 seconds.
    I tried to use COLLECT in BULK instead of a cursor for loop, but it did not help.
    When I took the select query separately and executed with a value of the sample, and then he gave the results in a Flash of a second.

    All tables have primary key index.
    Any ideas what can be done to make this code more efficient?

    Thank you
    Raj.
    DECLARE
      v_chain_id ah_chain_div_facility.chain_id%TYPE := ah_internal_data_pkg.get_chain_id (p_file_id);
    
      CURSOR cur_loop IS
      SELECT * -- better off explicitly specifying columns
      FROM ah_activity_internal aai,
      (SELECT DISTINCT aix.item_code_cust, ad.division, ai.shipper_ind, ai.special_sales_reserve_ind, ai.exe_location_ind
         INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
         FROM ah_item ai, ah_item_xref aix, ah_chain_div_facility acdf, ah_div ad
        WHERE ai.item_id_edw = aix.item_id_edw
          AND aix.facility_num = acdf.facility_code
          AND acdf.chain_id = v_chain_id
          AND acdf.div_id = ad.div_id) d
      WHERE aai.status_id = 30
        AND aai.file_id = p_file_id
        AND d.item_code_cust = aai.item_code_cust
        AND d.division = aai.division;         
    
    BEGIN
      FOR rec IN cur_loop LOOP
        ... DO your stuff ...
      END LOOP;
    END;  
    

    Published by: Dave hemming on December 4, 2008 09:17

  • SELECT query time-out - huge table

    DBA dear friends,


    DB version 11.1.0.7.  I have a SELECT query that is running long and wedging on. Query joins the 2 tables. It is partitioned hash (16 sheets) and others are not partitioned, each table is with the same volume of data - 230 million lines.

    > Optimizer stats are not outdated

    SELECT only 1 row (as indicated in the PLAN of EXPLAIN) should be fast.

  • Create lines based on the difference in date

    Hello

    I would like to create lines based on the difference between the start and end dates (per year).

    for example

    ID1  Start_time                                             End_time                                                      ID2
    07/01/2003 1, 12.00.00.000000000 2005-01-07 12.00.00.000000000 123

    07/01/1999 1, 12.00.00.000000000 07/01/2003 12.00.00.000000000 345

    I need:

    ID1  Start_time                                             End_time                                                      ID2
    07/01/2004 1, 12.00.00.000000000 2005-01-07 12.00.00.000000000 123

    07/01/2003 1 12.00.00.000000000 07/01/2004 12.00.00.000000000 123

    1 01/07/2002 12.00.00.000000000 07/01/2003 12.00.00.000000000 345

    07/01/2001 1, 12.00.00.000000000 01/07/2002 12.00.00.000000000 345

    07/01/2000 1, 12.00.00.000000000 01/07/2001 12.00.00.000000000 345

    07/01/1999 1, 12.00.00.000000000 07/01/2000 12.00.00.000000000 345

    Thank you

    Hello

    Here's one way:

    SELECT ID1

    , ADD_MONTHS (start_time, 12 * (LEVEL - 1)) AS start_time value

    , ADD_MONTHS (start_time, 12 * LEVEL) AS end_time

    id2

    FROM table_x

    CONNECT BY LEVEL<= months_between="" (end_time,="" start_time)="">

    AND PRIOR id2 = id2

    AND PRIOR SYS_GUID () IS NOT NULL

    ;

    I'm assuming that id2 is unique.

    Would what results you if end_time wasn't exactly N years after start_time?

  • Error in the SELECT query

    Hello

    Oracle version: 11g R2 (11.2.0.2)

    I get the following error message (I'm using TOAD for Oracle last version 12.1):

    ORA-12801: error reported in the parallel query P032 Server

    ORA-01114: block write IO file error (block #)

    ORA-01114: IO error to the file 201 (block # 2165248) writing block

    ORA-27072: IO file error

    Linux-x86_64 error: 28: no space is available on the device

    Additional information: 4

    When you run a SELECT query:

    SELECT field1, Field2...

    OF (REVENUE_SOURCE b

    INNER JOIN ACCOUNTS_CLASSIFICATION one

    WE b.SUB_ACCOUNT = a.SUB_ACCOUNT)

    INNER JOIN REPORT_PRODUCT_ID c

    ON b.REPORT_PRODUCT_ID = c.REPORT_PRODUCT_ID

    WHERE a.UC_BUSINESS_UNIT = 'ANX.

    AND b.report_mm > =.

    (SELECT ADD_MONTHS (MAX (report_mm),-13))

    OF REVENUE_SOURCE)

    AND b.REVENUE_FLAG = - 1

    AND (b.CALLS <>0 b.MINUTES <>0 b.CHARGE_AMOUNT GOLD <>GOLD 0);

    Please notify.

    NOTE: the query worked well for a while, no errors, then all suddenly it became much accentsr and then I started to get the error message above.

    Kind regards

    M.R.

    Hello

    ORA-27072: IO file error

    Linux-x86_64 error: 28: no space is available on the device

    Looks like a system or OS, no SQL or PL/SQL problem problem.  I think you will answer sooner if you check this issue as 'Response' and start a new question in the forum of "General Question":

    https://forums.Oracle.com/community/Developer/English/oracle_database/general_questions/content

    My guess is that Oracle tries to allocate space in the tablespace temp, but cannot because the disk is full.  If you have a full disk, then create the space to this topic.

    I see nothing wrong with your code; Certainly, nothing which would cause an error like that.  The fact that the query has worked well for some time confirms that there is noting wrong with the request itself; It is just triggering a mistake elsewhere.

  • as with the select query

    Hello

    I have a query something like...

    Select...

    ....

    where

    b.ProdName as 'GEAR of the TREE %' or b.prodname like '% FRONT GEAR %' or b.prodname like '% BREAK 4 %k '.

    and

    b.ProdName as

    (select the name of the society of companyms

    where < some comdition >

    )

    order of 3.6

    I have blocked in:

    b.ProdName as

    (select the name of the society of companyms

    where < some comdition >

    )

    How to give a select query with like operator.

    In above query I want to b.prodname as above and the name of the company for which I give condition.  Company names are stored in another table and I want to select and use them with like operator.

    Thank you.

    Hello

    It is not clear what you want to do.

    One possibility is an EXISTS subquery, like this:

    ...

    WHERE (b.prodname LIKE "% of the CYCLE of the TREE" - begins with this text

    OR b.prodname LIKE '% FRONT GEAR %' - contains this text

    OR b.prodname LIKE '% BREAK 4 %k' - contains this text

    )

    AND THERE ARE)

    SELECT 1

    OF companynms

    WHERE--a condition

    AND b.prodname AS business

    )

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • Could not commit: ORA-00928: lack of creating the table SELECT keyword

    Hello guys.
    I tried to create the table with web interface on oracle 11g.

    I just follow this path on interface: schema-> table-> create-> standard (lot organized)-> SQl select on (set using the)->
    and I just use these scripts to create the table:

    CREATE TABLE suppliers
    (the number (10) of supplier_id not null,)
    supplier_name varchar2 (50) not null,
    Contact_Name varchar2 (50)
    );

    but this error occurred: failed to commit: ORA-00928: lack of SELECT key word!
    Please lock on this picture for more information: http://s17.postimg.org/kgoumzmvz/attachment.jpg

    could you help me please?
    and I could not find any manual for working with the web interface in oracle 11g.
    Please give me somesources to start.
    Thank you.

    1003778 wrote:
    Thank you sybrand_b
    but I already read this document.
    Unfortunately, there is nothing on the creation of table with sql scripts in this document!

    and I really don't understand how to create table with SQL commands! My question has not yet been answered.
    you please give me little details about it?
    for example, how can create table using this sql command:

    CREATE TABLE suppliers
    (the number (10) of supplier_id not null,)
    supplier_name varchar2 (50) not null,
    Contact_Name varchar2 (50)
    );

    Thank you.

    Edited by: 1003778 may 3, 2013 11:43

    When you got to the CREATE TABLE screen, you have selected "set using the--> SQL.
    Did you notice in the window that appears, just above this entry field is this text: "enter a SQL * select * statement below.» ' + This query results will be used to fill the table with Canada.* + "(underlining)
    And hip, just to the left of this field is this text: «CREATE TABLE AS»

    He tries to build a ' CREATE TABLE AS SELECT... ». Creates a table with the same structure as the table in which you SELECT and fills with the results of this SELECT '. With your entry, you create a CREATE TABLE AS CREATE TABLE to read statement...

    If you want to create your tables with a simple CREATE TABLE command, go to sqlplus and do it. You want to have a graphical interface to help build a simple CREATE table, when you get to the CREATE TABLE page, just to stay there with the default "use Define-> column specification." If you want, after completing "build" your table specification here, you will have a "Show sql" option to show you the actual sql statement that will be executed to create your table.

  • How to run a Select query stored in a Variable

    Hello

    I have a following requirement:

    Select a query result on Var1, result of another request selection in Var2,
    If Va2 = "value11" or Var2 = "Value2" then Var1 = "select query. Now how can I run this SQL at the end of the Pl/SQL query?

    so I write request for the same thing:

    DECLARE
    qry nvarchar2 (500);
    result nvarchar2 (500);

    BEGIN

    Select "choose TEXTVAL as 'CHARGER' FROM TABLE1 WHERE LOC =" [ParameterValue] "and KEYNAME =" < < REPLACE > > "' double INTO qry ;"

    SELECT CASE County WHEN (RW." CountofBATCH') > 1 then "mixture."
    WHEN count (RW." CountofMAT') = 0 then 'None '.
    ANOTHER 'other '.
    END
    AS a result
    TABLENAME2 TT, XMLTable ('/ sets of lines/lines/lines ' PASSAGE TT.) XMLCOL
    COLUMNS
    "CountofBATCH" PATH "/ row [CLABS > 0] / LOADED ',"
    "CountofMAT" PATH "/ row [MATNR = '[parameter value]'] / MAST '"
    ) AS RW

    where
    TT.PL = '[parameter value]' and
    TT. TANK = "[value settings]";

    IF result = 'Mixture' result GOLD = 'None' THEN
    qry: replace = (qry, "< < REPLACE > >", result);
    on the other
    qry: = 'nothing. '
    END IF;

    Thus the qry variable will have select statement. Now how can I use this to get the select result of this statement in the same query qry?

    You can use execute immediately if the output of the query is in the same query.

    It's very simple.
    a query string signle and then go like this

    declare
    qry VARCHAR2 (255);
    result varcharf2 (2500);
    number of vempid: = 1;

    Start
    qry: =' select empname emp where empid =: empid ";

    run immediately qry in the result using vempid;
    -now the result of data is as a result
    end;

Maybe you are looking for