Using the result of string_to_table in SQL

Hello

My apologies if this has already been answered - I couldn't get the right combination of search terms to find what I was looking for.

I would like to know if there is a way to use the exit or APEX_UTIL.string_to_table directly in SQL without additional programming (I know I could create table type VARCHAR2 and CAST at a table - basically I wonder if this has already been done for you or not with the APEX).

If the end query would be something like:
UPDATE my_table
   SET column_a = 12345
 WHERE my_id_column IN (SELECT column_value FROM TABLE(APEX_UTIL.string_to_table(:P1_MY_MULTISELECTLIST)));
Kind regards

Gareth.

Hi Dan/Gareth,

You don't need to create a function to handle this (although it is usually best if you have large lists of conversion of a table).

Take a look on: Re: report filters using lists Multi Select region

Andy

Tags: Database

Similar Questions

  • iPhone 6s - while trying to search using the result of Safari a padlock before and nothing will be open

    using the iPhone 6 s last updated - when trying to search using the result of Safari a padlock in front of him and nothing does not open in the list below!

    Please wait until a fix is available at Apple.

    Best.

  • Using the result of the Action as input for one other Action - is not possible?

    Hello

    I have something I call the presentation. According to our phases of deployment, it will return the fields it is possible to select.

    Domain-> GetAction("com.companyxyz.presentation","getDomainsForDeploymentStage").call (#deploymentStage)

    Then I want to take a vlan backup according to the field

    VLAN-> GetAction("com.__companyxyz__.presentation","getBackupVlan").call (#deploymentStage, #Domain)

    However, the '#Domain' value is always zero in action script.

    If I use GetAction("com.__companyxyz__.presentation","getBackupVlan").call (#deploymentStage, "server.local"), it returns the expected value.

    Is there a limitation that I can't use the results as input for another action action?


    I use vRO 7.0

    Hello

    It's certainly doable.

    I guess deploymentStage, domain and vlan are the input parameters for the workflow, right? There are two things to check carefully:

    • First of all, make sure your actions getDomainsForDeploymentStage and getBackupVlan handle code values no entry script gracefully.
    • Then, it depends on what property of presentation you linked calls from these actions. It is by default? If so, please change it to data binding, default values are calculated only once, at the beginning of the presentation run, and it is possible that, currently, the deploymentStage value is always set to null. On the other hand, the data bindings are calculated on every time the fields that they depend on, so your actions can be called with null deploymentStage first, but then, when deploymentStage gets its real value, the data bindings will be calculated with the non null deploymentStage.
  • How to use the T distribution table in sql statements?

    Hi all

    I'm in the need to use the T distribution table in sql... I don't know how to use...

    Is there a function to use the values of table in sql statements?

    Can someone please help me in this?

    How about this http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions157.htm#i1279931?

    Concerning

    Etbin

  • Use the results of ore RQTableEval in a PL/SQL module

    Documentation of ore RQTableEval show how to display the results in the form of a query using the syntax "SELECT * FROM TABLE (RQTableEval ( blah, blah ". "))"    I use the option 'select' for the third parameter of RQTableEval.

    But how can I access this result within a PL/SQL module?  This syntax raises a compile error of

    • Error (76,32): PL/SQL: ORA-22905: cannot access the rows of a table not nested element

    Open the speed for select * from table (rqTableEval ( blah, blah ))

    where speed is a weakly typed SYS_REFCURSOR

    I'm out of ideas/knowledge to solve this problem.

    You might want to try display in space R Oracle here: R Technologies

    John

  • SQL how to use a variable and use the result as a reference for the name of the table

    Hi all

    I have new in the declaration of Oracle, sorry in advance if something is easy for you all. BTW, I have this scenario:

    I have a table OL structured in this way:

    Date - it contains dates, for example 11/01/2015

    TableName - it contains strings, for example, OL1, OL2, OL3 and so on...

    Then I have a different table, the name of these tables are of the same name in the table of the OL, so I have table table, OL1, OL2, OL3 table and so on. The structure of these tables is the same. And Yes.

    table OL1

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

    ID LAST NAME FIRST NAME PHONE

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

    1 JOHN DOE 12345679

    2 PAUL 111111122 TIBBS

    table OL2

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

    ID LAST NAME FIRST NAME PHONE

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

    1 ANNA KRAIG (NULL)

    NATHAN FRESHMANN 111111133 2

    If the scenario is clear, I would like to retrieve the value (null), research in all the OL * tables by using the value of the OL table (tablename) max.

    If I'm going to do these simple steps, I got the result:

    Select max (TableName) OL

    the result will be OL2

    # I know not how to use the option set to avoid changing the table name in the sql statement all the time.

    set mytable = 'OL2.

    Select Name, family name

    of & mytable

    When the phone is null

    Any idea?

    Thank you very much in advance.

    Hello

    run immediately "select dt.log_id, obj.presentation_name, dl.begin_time

    bulk collect into v_result_set

    of ' | v_ol |' dt join internal ol_object obj on

    DT.object_type_id = obj.object_type_id

    inner join ol_chunk_log dl on

    DT.log_id = DL.log_id

    where dt.data_value is null';

    dbms_output.put_line (v_ol);

    end;

    Correct the code such as:

    run immediately "select dt.log_id, obj.presentation_name, dl.begin_time

    of ' | v_ol |' dt join internal ol_object obj on

    DT.object_type_id = obj.object_type_id

    inner join ol_chunk_log dl on

    DT.log_id = DL.log_id

    where dt.data_value is null' bulk collect into v_result_set;


    for i in v_result_set.first ... v_result_set. Last

    loop

    dbms_output.put_line ('LOG ID: ' | ) ( v_result_set.log_id (i)) ;

    dbms_output.put_line (' NAME CLOSELY: ' |) v_result_set.presentation_name (i));

    dbms_output.put_line (' START TIME: ' |) ( v_result_set.begin_time (i)) ;

    end loop;

    end;

    Kind regards.

  • How can I show all the results returned by a sql query?

    Hi guys,.

    I need your help.
    Let's say I have a table: TableA. Fields in TableA are aleg, anon, monkeys. The following sentence can return, in general, several rows: select anon from TableA where aleg = somevalue. I would like to show the result of the anon column but no luck. If I try to display the results in a TextArea and the origin is a sql query shows that the first value of the line. I tried to see the like: display text (based in PLSQL) and a block anonymous plsql and coding
    DECLARE
    v_anon TableA.anon%TYPE;
    CURSOR v_cur IS
    Select anon from TableA where aleg = somevalue;
    BEGIN
    OPEN v_cur.
    LOOP
    SEEK v_cur INTO v_anon;
    EXIT WHEN v_cur % NOTFOUND;
    : FIELD_IN_FORM: = v_anon;
    END LOOP;
    CLOSE V_cur;
    END;
    but in this case, he showed no results.
    So the first question is what type of field can I use to show the result. And the second is what can I do to be able to show all the results returned by the query (if more than one line).

    concerning

    GMC

    We are all happy that you found a solution, but you must sign your messages and change your ID forum. It is always good to know the real name of the person you are communicating with. In addition, if you plan to get answer to your questions in the future, you must mark responses as useful or correct if they helped you solve your problems.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • How to use the result of widget radio selection to 'show' a text box?

    Hello again,

    I have a question about widgets.

    What I want to do is to take the result of radio button widgets (in this case 1 2 rather long sentences that were available) and which will display a text box on another screen.

    Background: I have a series of slides where I ask the questions of the learner through Radio button widgets and so I get a number of variables (= penalty) they choose.

    The question I have is that I want to display all the choices they made on 1 page. Because the possible answers are relatively long I have run out of space if I simply inserts

    variables to shown as such and/or the police gets too small.

    So my idea is to use the answer that they choose to make a text box with a shorter version of the same appearo of sentence on this slide 'results '.

    So my idea is to have the learner to make their selection, then use a tip action to check what answer (= the option button), they clicked on.

    What I would do through "If XYZ variable ' 'contains (a keyword of the long sentence)' then 'show textbox YZ' etc.

    Question 1: Is this the most simple/more convenient way or I can save me time somwhow?

    2 "contain" a medium of action adv. the exact text or it may be just one of the words (out of the long sentence that could be selected)? I ask because then I have to use the same long exact phrase in the NOA that seems awkward.

    3. I need to create a separate fast action for each radio widget, I've used. Is this correct?

    4 if I then say 5 adv. actions for different questions, I asked what should trigger these advanc. action? The goal is just to shorten the long sentences in the selections made?

    If I use ' enter' for all the screen I just started one, I haven´t?

    Many probably incorrect assumptions, on my part, I guess...

    Any help is greatly appreciated!

    In my example the var who will get the short sentence is v_class. It's always the variable associated with the interaction of radio buttons. You have as much of these variables to be inserted on the last slide you have interactions button radio please never enter the variable to insert, but use the X button in the role of composition of the properties panel for the text container. Variables are case sensitive, in this way, you will avoid typos.

  • Creating external Tables using the EXECUTE IMMEDIATE in PL/SQL

    Hi guys,.

    I am trying to create an external Table using the EXECUTE IMMEDIATE in a procedure and I managed to compile and no errors were generated. But when I try to run it from sql using the exec command I get the following error:

    ------------------------------------------------------------------------
    ERROR on line 5:
    ORA-00911: invalid character
    ORA-06512: at "GEO. TEST_DDL', line 4
    ORA-06512: at line 5

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

    I tried to check the whole statement to create the external table, but I can't find where is the error. Surprisingly, if I simply run the command table create external on sqlplus it works, but not a procedure.

    If anyone can help with ideas or experience?

    Geoffrey Kossami

    The error means that there is an identifier somewhere that starts with a nonalphanumeric. This is a typical mistake of editing. A procedure compiles correctly is not of course because the underlying dynamic sql running is OK. Which of course only be resolved when you try to run it.

    There is certainly a problem with the text you provide to be run as a piece of dynamic sql code. You should try to watch it with dbms_output and run this code in sqlplus. But your problem is with the code you run as dynamic PL/SQL, it is not itself compilable.

    Jack

  • ORA-00900 when you use the command COPY with dynamic SQL

    Helllo,
    I created the following procedure:

    create or replace procedure copyTable (pSourceTableOwner IN varchar2
    pSourceTableOwnerPasword IN varchar2
    pTargetTableOwner IN varchar2
    pTableName IN varchar2
    pDatabaseLink IN varchar2)
    as

    vStatement varchar2 (250): = null;

    Start

    vStatement: = "copy of". pSourceTableOwner | '/' || pSourceTableOwnerPasword | '@' || pDatabaseLink |
    "Insert" | pTargetTableOwner | '.' || pTableName | ' using select * from '. pTableName;

    immediately run vStatement;

    end;
    /

    The generated command (variable vStatement) looks like this:
    "Insert a copy of O_GLCEN/o_glcen@SELLENTW o_jh. "X_PLZ_CD_MERGED_CTIS using select * from X_PLZ_CD_MERGED_CTIS".

    When you call this procedure as "exec copyTable ('O_GLCEN', 'o_glcen', 'o_jh', 'X_PLZ_CD_MERGED_CTIS', 'SELLENTW');" the following lifts:

    FEHLER in line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at "SYSTEMTECHNIK". COPYTABLE", line 20
    ORA-06512: at line 1

    But when you call the command COPY directly from SQL prompt the statement runs without error.
    Is in general not possible to use the dynamic COPY with SQL command? If it is possible does anyone has an idea what I am doing wrong?

    Any help will be appreciated...

    Rgds
    JH

    I would like to use something like

    vStatement: = ' start in f (select * from ' | pSourceTableOwner |) '.' || pTableName | '@' || pDatabaseLink | Insert loop ') in ' | pTargetTableOwner | '.' || pTableName | "f-values; end loop; end; »
    immediately run vStatement;

  • Concatenate the result set into a SQL string

    Hi, I need help with the concatenation of a result set in order to avoid the duplication of data.

    I have 3 tables:

    SCRIPT
    ID - number PK
    DATE - day
    TITLE - Varchar2

    AUTHOR
    A_ID - number PK
    A_Name - Varchar2

    SCRIPT_AUTHOR
    ID - number - PK, FK of Script.ID
    A_ID - number PK, FK of Author. A_ID


    I need the list of all authors for each script on a single line, for the moment I have the following SQL code:

    Select S.Title, SA. A.ID
    SCRIPT S, SCRIPT_AUTHOR SA
    WHERE SCRIPT.ID = SCRIPT_AUTHOR.ID


    and as expected it's returning a dataset as follows:-give me 2 lines in this case for a script:

    S.TITLE, SA. A_ID
    1, 1
    1, 2

    What I'm really after is a result set that combines the two authors in this case a file: 1, 1:2, so I don't have 1 line by script.
    Scripts can have many authors, and I want to do it for a lot of scripts at a time.

    I hit a blank on how to do it, is it possible to do it with SQL?

    Thank you very much

    p.s. help: Oracle Database 10g Enterprise Edition release 10.2.0.3.0

    Hello

    This is called 'aggregation of chain.
    [AskTom.oracle.com | http://asktom.oracle.com/pls/asktom/f?p=100: 11:0:P11_QUESTION_ID:2196162600402] shows several ways to do so.

    I recommend the first, the function defined by the user STRAGG, that you can copy from this page.

    Once you have installed STRAGG, your query is simply

    Select       S.Title
    ,       STRAGG (SA.A.ID)     AS sa_id_list
    FROM       SCRIPT     S
    ,       SCRIPT_AUTHOR SA
    WHERE       SCRIPT.ID = SCRIPT_AUTHOR.ID
    GROUPB BY s.Title;
    

    On Oracle 10 (and more) you can have a similar function, the WM_CONCAT (property WMSYS), already installed.
    WM_CONCAT is not documented, so you can't use it in your Production applications.

  • How to get rid of repeat groups using the query? Its my sql script.

    Mr President.

    worm of Oracle's 10g express edition

    I want to get rid of repeating groups and wants to get result like

    1. 1 RAM null 200 222,0
    2. DVD Player 2 25 34.0
    3. 3 HDD 160 GB Satta 40 49.0
    4. 4 LCD 19\ monitor"20 28.0
    5. 5 color 10 18,0 HP printer
    6. 6 keyboard multimedia keyboard 50 69.0
    7. 7 custom mouse mouse 150 248,0

    If my table script is as below

    BEGIN
           
     -- drop tables 
      EXECUTE IMMEDIATE 'DROP TABLE CUSTOMER';   
      EXECUTE IMMEDIATE 'DROP TABLE PRODUCT';   
      EXECUTE IMMEDIATE 'DROP TABLE SUPPLIER';   
      EXECUTE IMMEDIATE 'DROP TABLE PURCHASE';   
      EXECUTE IMMEDIATE 'DROP TABLE PURCHASELINE';   
      EXECUTE IMMEDIATE 'DROP TABLE SALES';   
      EXECUTE IMMEDIATE 'DROP TABLE SALESLINE';
      EXECUTE IMMEDIATE 'DROP TABLE STOCK';
      
    EXCEPTION
      WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE('');
    END;
    /
    
    
    CREATE TABLE CUSTOMER 
    (
      cust_id NUMBER        NOT NULL
    , name VARCHAR2(50)  NOT NULL
    , address VARCHAR2(100) DEFAULT NULL
    , contactno VARCHAR2(20)  DEFAULT NULL
    , CONSTRAINT CUSTOMER_PK PRIMARY KEY 
      (
        cust_id
      )
      ENABLE 
    );  
    
    
    CREATE TABLE PRODUCT 
    (
      prod_id   NUMBER       NOT NULL
    , name   VARCHAR2(50) NOT NULL
    , description VARCHAR2(50) DEFAULT NULL
    , CONSTRAINT PRODUCT_PK PRIMARY KEY 
      (
        prod_id
      )
      ENABLE 
    );  
    CREATE TABLE SUPPLIER 
    (
      suplr_id   NUMBER        NOT NULL
    , name   VARCHAR2(50)  NOT NULL
    , address VARCHAR2(100) DEFAULT NULL
    , contactno VARCHAR2(20)  DEFAULT NULL
    , CONSTRAINT SUPPLIER_PK PRIMARY KEY 
      (
        suplr_id
      )
      ENABLE 
    );  
    
    
    CREATE TABLE PURCHASE (
      pur_id NUMBER NOT NULL
    , pur_date DATE   NOT NULL  
    , suplr_id NUMBER DEFAULT '0'
    , CONSTRAINT PUR_SUPLR_FK FOREIGN KEY 
      (
      suplr_id
      )
      REFERENCES SUPPLIER 
      (
      suplr_id
      )
    , CONSTRAINT PURCHASE_PK PRIMARY KEY 
      (
        pur_id
      )
      ENABLE 
    );  
    
    
    CREATE TABLE PURCHASELINE (
      pur_id NUMBER DEFAULT '0' NOT NULL
    , prod_id NUMBER DEFAULT '0' NOT NULL
    , pur_qty NUMBER DEFAULT '0' NOT NULL
    , unit_pur_price NUMBER DEFAULT '0' NOT NULL
    , CONSTRAINT PUR_LINE_PUR_FK FOREIGN KEY 
      (
      pur_id
      )
      REFERENCES PURCHASE
      (
      pur_id
      )
    , CONSTRAINT PUR_LINE_POD_FK FOREIGN KEY
      (
        prod_id
      )
      REFERENCES PRODUCT
      (
      prod_id
      )
    , CONSTRAINT PUR_LINE_PK PRIMARY KEY 
      (
        pur_id,prod_id
      )
      ENABLE 
    );  
    
    
    CREATE TABLE SALES (
      sal_id NUMBER NOT NULL
    , sal_date DATE   DEFAULT NULL  
    , cust_id NUMBER DEFAULT '0'
    , CONSTRAINT PUR_CUSTR_FK FOREIGN KEY 
      (
      cust_id
      )
      REFERENCES CUSTOMER
      (
      cust_id
      )
    , CONSTRAINT SALES_PK PRIMARY KEY 
      (
        sal_id
      )
      ENABLE 
    );  
    
    
    CREATE TABLE SALESLINE (
      sal_id NUMBER DEFAULT '0' NOT NULL
    , prod_id NUMBER DEFAULT '0' NOT NULL
    , sal_qty NUMBER DEFAULT '0' NOT NULL
    , unit_sal_price NUMBER DEFAULT '0' NOT NULL
    , CONSTRAINT SAL_LINE_SAL_FK FOREIGN KEY 
      (
      sal_id
      )
      REFERENCES SALES
      (
      sal_id
      )
    , CONSTRAINT SAL_LINE_POD_FK FOREIGN KEY
      (
        prod_id
      )
      REFERENCES PRODUCT
      (
      prod_id
      )
    , CONSTRAINT SAL_LINE_PK PRIMARY KEY 
      (
        sal_id,prod_id
      )
      ENABLE 
    ); 
    
    
    CREATE TABLE STOCK (
      prod_id NUMBER NOT NULL
    , prod_qty NUMBER DEFAULT '0' NOT NULL
    , re_ord_level NUMBER DEFAULT '0' NOT NULL
    , CONSTRAINT STOCK_POD_FK FOREIGN KEY
      (
        prod_id
      )
      REFERENCES PRODUCT
      (
      prod_id
      )
    , CONSTRAINT STOCK_PK PRIMARY KEY 
      (
        prod_id
      )
      ENABLE 
    );   
    
    
    
    
    SET DEFINE OFF;
    
    
    -- ***** Populate Tables *****
    
    
    
    
    --CUSTOMER table data
    
    
    INSERT INTO CUSTOMER VALUES(1,'Kamrul Hasan','Moghbazar, Dhaka','0456789123');
    INSERT INTO CUSTOMER VALUES(2,'Rabiul Alam','Motijheel, Dhaka','0567891234');
    INSERT INTO CUSTOMER VALUES(3,'Shahed Hasan','2-G/1,2-2,Mirpur, Dhaka','0678912345');
    
    
    --PRODUCT table data
    
    
    INSERT INTO PRODUCT VALUES(1,'RAM',NULL);
    INSERT INTO PRODUCT VALUES(2,'DVD Drive',NULL);
    INSERT INTO PRODUCT VALUES(3,'HDD','160 GB Satta');
    INSERT INTO PRODUCT VALUES(4,'Monitor','LCD 19\"');
    INSERT INTO PRODUCT VALUES(5,'Printer','HP Color');
    INSERT INTO PRODUCT VALUES(6,'Keyboard','Multimedia Keyborad (Customised)');
    INSERT INTO PRODUCT VALUES(7,'Mouse','Customised Mouse');
    
    
    -- SUPPLIER table data
    
    
    INSERT INTO SUPPLIER VALUES(1,'Salam Enterprise','2-H/1-10, Mirpur, Dhaka, Bangladesh','0123456789');
    INSERT INTO SUPPLIER VALUES(2,'ABC Supplies','Dhanmondi, Dhaka','0234567891');
    INSERT INTO SUPPLIER VALUES(3,'XYZ Company','52 Gabtali, Dhaka','0345678912');
    
    
    
    
    --PURCHASE table data
    
    
    INSERT INTO PURCHASE VALUES(1,TO_DATE('12-12-2007','dd-mm-yyyy'),1);
    INSERT INTO PURCHASE VALUES(2,TO_DATE('13-12-2007','dd-mm-yyyy'),2);
    INSERT INTO PURCHASE VALUES(3,TO_DATE('13-12-2007','dd-mm-yyyy'),1);
    INSERT INTO PURCHASE VALUES(4,TO_DATE('14-12-2007','dd-mm-yyyy'),1);
    INSERT INTO PURCHASE VALUES(5,TO_DATE('15-12-2007','dd-mm-yyyy'),2);
    INSERT INTO PURCHASE VALUES(6,TO_DATE('20-12-2007','dd-mm-yyyy'),3);
    INSERT INTO PURCHASE VALUES(7,TO_DATE('05-01-2007','dd-mm-yyyy'),2);
    INSERT INTO PURCHASE VALUES(8,TO_DATE('06-05-2007','dd-mm-yyyy'),3);
    INSERT INTO PURCHASE VALUES(9,TO_DATE('15-07-2008','dd-mm-yyyy'),1);
       
    
    
    --PURCHASELINE table data
    INSERT INTO PURCHASELINE VALUES(1,1,25,900);
    INSERT INTO PURCHASELINE VALUES(1,2,10,1700);
    INSERT INTO PURCHASELINE VALUES(1,3,10,5000);
    INSERT INTO PURCHASELINE VALUES(1,4,9,5500);
    INSERT INTO PURCHASELINE VALUES(1,7,100,250);
    INSERT INTO PURCHASELINE VALUES(2,3,15,5000);
    INSERT INTO PURCHASELINE VALUES(2,6,20,500);
    INSERT INTO PURCHASELINE VALUES(3,6,25,450);  
    INSERT INTO PURCHASELINE VALUES(4,7,100,200);  
    INSERT INTO PURCHASELINE VALUES(5,5,10,3450);  
    INSERT INTO PURCHASELINE VALUES(5,6,10,180);  
    INSERT INTO PURCHASELINE VALUES(6,1,15,900); 
    
    
    
    
    --SALES table data
    INSERT INTO SALES VALUES(1,TO_DATE('12-12-2007','dd-mm-yyyy'),2); 
    INSERT INTO SALES VALUES(2,TO_DATE('15-12-2007','dd-mm-yyyy'),3);
    INSERT INTO SALES VALUES(3,TO_DATE('20-12-2007','dd-mm-yyyy'),2);
    INSERT INTO SALES VALUES(4,TO_DATE('28-12-2007','dd-mm-yyyy'),3);
    INSERT INTO SALES VALUES(5,TO_DATE('05-01-2008','dd-mm-yyyy'),1);
    INSERT INTO SALES VALUES(6,TO_DATE('12-01-2008','dd-mm-yyyy'),3);
    INSERT INTO SALES VALUES(7,TO_DATE('12-02-2008','dd-mm-yyyy'),1);
    INSERT INTO SALES VALUES(8,TO_DATE('12-02-2008','dd-mm-yyyy'),2);
    INSERT INTO SALES VALUES(9,TO_DATE('12-02-2008','dd-mm-yyyy'),3); 
    
    
    --SALESLINE table data
    INSERT INTO SALESLINE VALUES(1,1,3,1000);
    INSERT INTO SALESLINE VALUES(1,3,1,5500);
    INSERT INTO SALESLINE VALUES(1,4,1,6000); 
    INSERT INTO SALESLINE VALUES(1,6,2,500);  
    INSERT INTO SALESLINE VALUES(1,7,2,200);   
    INSERT INTO SALESLINE VALUES(2,2,2,1900);    
    INSERT INTO SALESLINE VALUES(2,7,2,200);     
    INSERT INTO SALESLINE VALUES(3,4,1,5500);     
    INSERT INTO SALESLINE VALUES(4,2,1,2200);     
    INSERT INTO SALESLINE VALUES(5,6,1,300);      
    INSERT INTO SALESLINE VALUES(5,7,2,250);      
    INSERT INTO SALESLINE VALUES(6,6,1,300);       
    INSERT INTO SALESLINE VALUES(6,7,3,180);        
    INSERT INTO SALESLINE VALUES(7,1,2,1000);         
    INSERT INTO SALESLINE VALUES(7,2,1,1900);          
    INSERT INTO SALESLINE VALUES(7,3,2,5500);           
    INSERT INTO SALESLINE VALUES(8,4,1,5500);            
    INSERT INTO SALESLINE VALUES(8,6,2,300);             
    INSERT INTO SALESLINE VALUES(8,7,1,200);              
    INSERT INTO SALESLINE VALUES(9,1,3,1000);               
    INSERT INTO SALESLINE VALUES(9,3,2,5500);                
    INSERT INTO SALESLINE VALUES(9,5,2,1000);                 
    
    
    --STOCK table data
    INSERT INTO STOCK VALUES(1,200,15);
    INSERT INTO STOCK VALUES(2,25,10);
    INSERT INTO STOCK VALUES(3,40,10); 
    INSERT INTO STOCK VALUES(4,20,10); 
    INSERT INTO STOCK VALUES(5,10,10);  
    INSERT INTO STOCK VALUES(6,50,20);   
    INSERT INTO STOCK VALUES(7,150,20);    
    
    
    
    
    COMMIT;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    Concerning

    I could not figure out how you pulled your expected results, especially the last column. I guess that your problem I have several prod_id table productline / salesline. If a group of prod_id in these table should solve your problem. Something like that

    SQL> select p.prod_id         as product_prod_id
      2       , p.name            as product_name
      3       , p.description     as product_description
      4       , s.prod_qty        as stock_prod_qty
      5       , s.re_ord_level    as stock_re_ord_level
      6       , pl.pur_qty        as purchaseline_pur_qty
      7       , pl.unit_pur_price as purchaseline_unit_pur_price
      8       , sl.sal_qty        as salesline_sal_qty
      9       , sl.unit_sal_price as salesline_unit_sal_price
     10    from product p
     11    join stock s
     12      on p.prod_id = s.prod_id
     13    join (
     14            select prod_id
     15                 , sum(pur_qty) pur_qty
     16                 , sum(unit_pur_price) unit_pur_price
     17              from purchaseline
     18             group
     19                by prod_id
     20         ) pl
     21      on p.prod_id = pl.prod_id
     22    join (
     23            select prod_id
     24                 , sum(sal_qty) sal_qty
     25                 , sum(unit_sal_price) unit_sal_price
     26              from salesline
     27             group
     28                by prod_id
     29         ) sl
     30      on p.prod_id = sl.prod_id
     31   order
     32      by p.prod_id;
    
    PRODUCT_PROD_ID PRODUCT_NAME         PRODUCT_DESCRIPTION                      STOCK_PROD_QTY STOCK_RE_ORD_LEVEL PURCHASELINE_PUR_QTY PURCHASELINE_UNIT_PUR_PRICE SALESLINE_SAL_QTY SALESLINE_UNIT_SAL_PRICE
    --------------- -------------------- ---------------------------------------- -------------- ------------------ -------------------- --------------------------- ----------------- ------------------------
                  1 RAM                                                                      200                 15                   40                        1800                 8                     3000
                  2 DVD Drive                                                                 25                 10                   10                        1700                 4                     6000
                  3 HDD                  160 GB Satta                                         40                 10                   25                       10000                 5                    16500
                  4 Monitor              LCD 19\"                                             20                 10                    9                        5500                 3                    17000
                  5 Printer              HP Color                                             10                 10                   10                        3450                 2                     1000
                  6 Keyboard             Multimedia Keyborad (Customised)                     50                 20                   55                        1130                 6                     1400
                  7 Mouse                Customised Mouse                                    150                 20                  200                         450                10                     1030
    
    7 rows selected.
    
  • Using the custom on a box SQL PL/SQL function

    Hello

    Is it OK to use or the PL/SQL a SQL box-custom functions? Or is - against the standards? Thank you.

    What are the standards, the answer is Yes and no.
    -A function that returns a SYS_REFCURSOR will NOT work
    -A PIPELINED function and return a TABLE (a TYPE of OBJECT) will work

    SELECT id as PER_ID, description as EMAILID FROM TABLE(my_func('1234567890'));
    

    -A function returning a variable work

    SELECT PER_ID, my_func(:F1) AS PER_INFO  FROM CI_PER WHERE PER_ID = :F1;
    
  • DB Link using the gateway to Oracle to SQL server 2005

    Hi all

    I am facing problems to configure the gateway for Oracle database to connect to SQL server, given below are details:

    Machine has
    ----------------
    OS = Windows server 2008 R2 64 bit
    DB = Oracle 10.2.0.5 64-bit

    content of C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\*tnsnames.ora*

    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = WIN-G9TJ5GM2SAO)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
    )
    )

    dg4msql =
    (DESCRIPTION =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = 10.1.87.119)
    (PORT = 1521)
    )
    (CONNECT_DATA =
    (SID = dg4msql))
    (HS=OK))

    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    )
    )

    Machine B
    ----------------
    OS = Windows Server 2003 32-bit
    DB = SQL Server 2005 32-bit
    Gateway = Gateway Oracle 11 g 32 bit

    Content of C:\product\11.2.0\tg_1\dg4msql\admin*\initdg4msql.ora*

    HS_FDS_CONNECT_INFO = localhost:1433 / / SDÉS
    HS_FDS_TRACE_LEVEL = OFF
    HS_FDS_RECOVERY_ACCOUNT = RECOVERY
    HS_FDS_RECOVERY_PWD = RECOVERY

    Content of C:\product\11.2.0\tg_1\NETWORK\ADMIN\*listener.ora*

    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = eZeePay-DB)(PORT = 1521))
    (ADDRESS = (PROTOCOL = CIP)(KEY = EXTPROC1521))
    )
    )

    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = dg4msql)
    (ORACLE_HOME = C:\product\11.2.0\tg_1)
    (PROGRAM = dg4msql)
    )
    )

    ADR_BASE_LISTENER = C:\product\11.2.0\tg_1

    On computer A, if I use TNSPING it gives below error

    C:\users\administrator > tnsping dg4msql

    AMT Ping Utility for 64-bit Windows: Version 10.2.0.5.0 - Production on 12-MAR-2
    012 11:44:12

    Copyright (c) 1997, 2010, Oracle. All rights reserved.

    Use settings files:
    C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora

    AMT-03505: failed to resolve the name


    Please please help what's not in configurations!

    Best regards!

    Irfan

    Published by: irf_mas on March 12, 2012 12:47 AM

    Hello Irfan,
    As far as I can see the correct air configuration files, but you can check a few things-

    1. they may have been lost when posting in the forum, but can do you that there is a space at the beginning of each line in the tnsnames.ora and listener.ora except for the first line of each section-

    ORCL =

    dg4msql =

    EXTPROC_CONNECTION_DATA =

    LISTENER =

    SID_LIST_LISTENER =

    2. What is in the file sqlnet.ota on the computer has?

    3. host 10.1.87.119 is the machine eZeePay-DB?

    4 is the gateway listener began the eZeePay DB?

    Kind regards
    Mike

  • Using the regular Expression of PL/SQL.

    Has ' light, I'm braindead today and cannot understand this. I have data that may be in the following formats:

    format 1:123 (A XXX)"
    format 2:123 (A (XXX) Z)'
    Formula 3:123 (A (XXX) Z) (B (YYY) Z)'

    Looking for a regular expression that will analyze the data and return to:

    result 1: "(un XXX)" "
    result 2: "(un (XXX) Z)" "
    result 3: "(un (XXX) Z)" "

    Thanks for your help.

    Administer a shot:

    SQL> WITH test_data AS
      2  (
      3          SELECT '123 (A XXX)' AS TXT FROM DUAL UNION ALL
      4          SELECT '123 (A (XXX) Z)' AS TXT FROM DUAL UNION ALL
      5          SELECT '123 (A (XXX) Z)(B (YYY) Z)' AS TXT FROM DUAL
      6  )
      7  SELECT  REGEXP_SUBSTR
      8          (
      9                  TXT
     10          ,       '\([[:alpha:]]{1} \(?[[:alpha:]]{3}\)? ?[[:alpha:]]?\)?'
     11          )       AS NEW_TXT
     12  FROM    TEST_DATA
     13  /
    
    NEW_TXT
    --------------------------
    (A XXX)
    (A (XXX) Z)
    (A (XXX) Z)
    

    HTH!

Maybe you are looking for

  • Integration of the Mac server

    We are currently using Exchange 2008 and recently bought a Mac mini and configure the server to this topic. Please be warned, I am a newbie to this. My question is in 3 parts How can I know what is the address for Active Directory, because everything

  • Upgrade of 5100-201 - HARD drive

    My satellite 5100-201 has a 30 G 4200 RPM HARD drive -I see a big performance increase everything by replacing the HDD by a Hitachi 60 GB 2 "1 / 2 7200 tr/MIN/8 MB? -is it possible to change the drive hard and how? Thanks for the support

  • Cannot install multisim 11 Visual c ++ runtime error

    I always get runtime error while installing or multisim 11 on my PC my Configuration are Intel dual core 1.8ghz 1 GB ram and windows 7 Professional genuine fully updated what can be the possible reason, someone can tell me answer as soon as possible.

  • What exactly Windows 8 upgrade deletes?

    When upgrading to Windows 7, I see the option to "keep the settings of windows, applications and personal files. Help decide me window shows "personal folders. Whatever it is saved in the folder of the user is considered a personal folder, such as Do

  • JAG saknar infogasynbolen Ankare I have minutes CC 2015

    Ankarsymbolen kommer heller inte upp I designlage pa skarmen.(I DW CS5 fungerar det).Finns inte infoga icons eller det bar den Har jag som inte ar?