Help needed in returning multiple columns from one field

Hi,
I have been given a task to rewrite the query (see below), so that I get three columns from the one field, based on their contents.
The script returns all the columns and concatenates them into one, but returns them as comma delimmited within the returned column, to generate a report.
These tables are from Siebel.
Our Oracle version is:
select banner from sys.v_$version;
--returns
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
PL/SQL Release 8.1.7.4.0 - Production
CORE     8.1.7.0.0     Production
TNS for Solaris: Version 8.1.7.4.0 - Production
NLSRTL Version 3.4.1.0.0 - Production
Here is what I was given;
set arraysize 200
Spool d:\Daily_reports\Data\RegManage\Electricity\eCISPLUS_Product_Switch_Not_Started_Discount.csv
-- this will concatenate all the returned columns into one
SELECT DISTINCT '"'||
rtrim(ltrim(S_ORG_EXT.OU_NUM)) || '","' ||
rtrim(ltrim(S_ORG_EXT.NAME)) || '","' ||
rtrim(ltrim(S_EVT_ACT.TODO_CD)) || '","' ||
rtrim(ltrim(S_EVT_ACT.EVT_STAT_CD)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_SOURCE_TYPE)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_TXU_PRICELIST_NAME)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_CLASS_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_PEAKANYTIME_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_PA_CLASS_ELEC)) || '","' ||
rtrim(ltrim(S_ORG_EXT.X_OTH_ACCOUNT_NUMBER)) || '","' ||
rtrim(ltrim(S_ADDR_PER.X_NMI_NUM)) || '","' ||
rtrim(ltrim(S_ADDR_PER.X_NMI_CHECKSUM)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.QUOTE_NUM)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_COOLING_OFF_DATE)) || '","' ||
rtrim(ltrim(S_PROD_INT.NAME)) || '"'
The field S_PROD_INT.NAME is the one that I need to split so that it is retured
into three different columns.
1st column needed -
where S_PROD_INT.NAME Like 'Electricity TRUenergy Business Edge __ %'
OR S_PROD_INT.NAME Like 'Electricity TRUenergy Business Now __ %'
OR S_PROD_INT.NAME Like 'Electricity Go for More __ %'
OR S_PROD_INT.NAME Like 'Electricity Mates Rates __ %'
2nd column needed -
where S_PROD_INT.NAME Like 'Gas TRUenergy Business Edge __ %'
OR S_PROD_INT.NAME Like 'Gas TRUenergy Business Now __ %'
OR S_PROD_INT.NAME Like 'Gas Go for More __ %'
OR S_PROD_INT.NAME Like 'Gas Mates Rates __ %'
3rd column needed from
S_PROD_INT.NAME Like '* ___ Discount for Paying Your Bill by the Due Date')
-- Tables
FROM SIEBEL.S_ADDR_PER S_ADDR_PER,
SIEBEL.S_DOC_QUOTE S_DOC_QUOTE,
SIEBEL.S_EVT_ACT S_EVT_ACT,
SIEBEL.S_ORG_EXT S_ORG_EXT,
SIEBEL.S_PRI_LST S_PRI_LST,
SIEBEL.S_PROD_INT S_PROD_INT,
SIEBEL.S_QUOTE_ITEM S_QUOTE_ITEM
WHERE S_EVT_ACT.TARGET_OU_ID = S_ORG_EXT.ROW_ID
AND S_DOC_QUOTE.ROW_ID = S_QUOTE_ITEM.SD_ID
AND S_ADDR_PER.ROW_ID = S_ORG_EXT.PR_ADDR_ID
AND S_PROD_INT.ROW_ID = S_QUOTE_ITEM.PROD_ID
AND S_ORG_EXT.ROW_ID = S_DOC_QUOTE.TARGET_OU_ID
AND S_DOC_QUOTE.PRI_LST_ID = S_PRI_LST.ROW_ID
AND S_EVT_ACT.TODO_CD = 'Product Switch-Electricity'
AND S_EVT_ACT.EVT_STAT_CD In ('In Progress','Not Started','On Hold')
AND S_DOC_QUOTE.STAT_CD In ('Completed','Verbal Acceptance','Written Acceptance')
AND S_DOC_QUOTE.X_OFFER_TYPE = 'Product Switch'
AND (S_PROD_INT.NAME Like 'Electricity TRUenergy Business Edge __ %' OR S_PROD_INT.NAME Like 'Electricity TRUenergy Business Now __ %'
OR S_PROD_INT.NAME Like 'Electricity Go for More __ %' OR S_PROD_INT.NAME Like 'Electricity Mates Rates __ %'
OR S_PROD_INT.NAME Like 'Electricity __ Discount for Paying Your Bill by the Due Date' or S_PROD_INT.NAME Like 'Electricity TRUenergy Business Edge ___ %'
OR S_PROD_INT.NAME Like 'Electricity TRUenergy Business Now ___ %'
OR S_PROD_INT.NAME Like 'Electricity Go for More ___ %'
OR S_PROD_INT.NAME Like 'Electricity Mates Rates ___ %'
OR S_PROD_INT.NAME Like 'Electricity ___ Discount for Paying Your Bill by the Due Date')
UNION
SELECT DISTINCT '"'||
rtrim(ltrim(S_ORG_EXT.OU_NUM)) || '","' ||
rtrim(ltrim(S_ORG_EXT.NAME)) || '","' ||
rtrim(ltrim(S_EVT_ACT.TODO_CD)) || '","' ||
rtrim(ltrim(S_EVT_ACT.EVT_STAT_CD)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_SOURCE_TYPE)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_TXU_PRICELIST_NAME)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_CLASS_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_PEAKANYTIME_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_PA_CLASS_ELEC)) || '","' ||
rtrim(ltrim(S_ORG_EXT.X_OTH_ACCOUNT_NUMBER)) || '","' ||
rtrim(ltrim(S_ADDR_PER.X_NMI_NUM)) || '","' ||
rtrim(ltrim(S_ADDR_PER.X_NMI_CHECKSUM)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.QUOTE_NUM)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_COOLING_OFF_DATE)) || '"'
FROM SIEBEL.S_ADDR_PER S_ADDR_PER,
SIEBEL.S_DOC_QUOTE S_DOC_QUOTE,
SIEBEL.S_EVT_ACT S_EVT_ACT,
SIEBEL.S_ORG_EXT S_ORG_EXT,
SIEBEL.S_PRI_LST S_PRI_LST
WHERE S_EVT_ACT.TARGET_OU_ID = S_ORG_EXT.ROW_ID
AND S_ADDR_PER.ROW_ID = S_ORG_EXT.PR_ADDR_ID
AND S_ORG_EXT.ROW_ID = S_DOC_QUOTE.TARGET_OU_ID
AND S_DOC_QUOTE.PRI_LST_ID = S_PRI_LST.ROW_ID
AND S_EVT_ACT.TODO_CD = 'Product Switch-Electricity'
AND S_EVT_ACT.EVT_STAT_CD In ('In Progress','Not Started','On Hold')
AND S_DOC_QUOTE.STAT_CD In ('Completed','Verbal Acceptance','Written Acceptance')
AND S_DOC_QUOTE.X_OFFER_TYPE = 'Product Switch'
AND NOT EXISTS (SELECT /*+ unnest */ 'X'
FROM SIEBEL.S_PROD_INT S_PROD_INT, SIEBEL.S_QUOTE_ITEM S_QUOTE_ITEM
WHERE S_DOC_QUOTE.ROW_ID = S_QUOTE_ITEM.SD_ID
AND S_PROD_INT.ROW_ID = S_QUOTE_ITEM.PROD_ID
AND (S_PROD_INT.NAME Like 'Electricity TRUenergy Business Edge __ %'
OR S_PROD_INT.NAME Like 'Electricity TRUenergy Business Now __ %'
OR S_PROD_INT.NAME Like 'Electricity Go for More __ %'
OR S_PROD_INT.NAME Like 'Electricity Mates Rates __ %'
OR S_PROD_INT.NAME Like 'Electricity __ Discount for Paying Your Bill by the Due Date' or S_PROD_INT.NAME Like 'Electricity TRUenergy Business Edge ___ %'
OR S_PROD_INT.NAME Like 'Electricity TRUenergy Business Now ___ %'
OR S_PROD_INT.NAME Like 'Electricity Go for More ___ %'
OR S_PROD_INT.NAME Like 'Electricity Mates Rates ___ %'
OR S_PROD_INT.NAME Like 'Electricity ___ Discount for Paying Your Bill by the Due Date'));
spool off
This is what one row looks like;
"1-UWLHY","Alpha Vic Kelly Kay","Product Switch-Electricity","Not Started","AMBASS_50REBATE","Go Green PKANY-Powercor","QEGS1","GG","QEGS1","GG","","6407421678","8","1-UWLI6","12-JUN-07","Electricity Mates Rates 7% Discount"
we want
"1-UWLHY","Alpha Vic Kelly Kay","Product Switch-Electricity","Not Started","AMBASS_50REBATE","Go Green PKANY-Powercor","QEGS1","GG","QEGS1","GG","","6407421678","8","1-UWLI6","12-JUN-07",'Electricity Mates Rates 7% Discount","Gas TRUenergy Business Edge 10% Discount","Electricity 3% Discount for Paying Your Bill by the Due Date"
I have tried to:
- create a cursor
- each column as - ie
S_PROD_INT.NAME as "EVD",
S_PROD_INT.NAME as "GVD",
S_PROD_INT.NAME as "PbDDD"
but when I try to use them in where "EVD" Like 'etc...'
error that table does not exist
I have tried also as
where 'EVD' Like 'etc...' -- error
where EVD Like 'etc...' -- error
- create them as %TYPE variable
- more
but keep getting errors
Any ideas and help will be most appreciated as I have tried and researched all I can think and get my hands on with my limited skills.
Thanks.
Regards, Steve

Unfortunately my skills are not high enough as I obviously don't know where to put the code exaclty.
I am first just running it on the top part of the script but get the error;
ORA-00900: invalid SQL statement
What I am running is; -- Commented
WITH s_prod_int AS
SELECT 1 row_id, 'Electricity Mates Rates 7% Discount' name FROM s_prod_int --these were 'FROM dual' originally, I changed to s_prod_int (Received same error regardless whether from dual or s_prod_int)
UNION ALL
SELECT 1, 'Gas TRUenergy Business Edge 10% Discount' FROM s_prod_int
UNION ALL
SELECT 1, 'Electricity 3% Discount for Paying Your Bill by the Due Date' FROM s_prod_int
SELECT DISTINCT '"'||
rtrim(ltrim(S_ORG_EXT.OU_NUM)) || '","' ||
rtrim(ltrim(S_ORG_EXT.NAME)) || '","' ||
rtrim(ltrim(S_EVT_ACT.TODO_CD)) || '","' ||
rtrim(ltrim(S_EVT_ACT.EVT_STAT_CD)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_SOURCE_TYPE)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_TXU_PRICELIST_NAME)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_CLASS_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_PEAKANYTIME_ELEC)) || '","' ||
rtrim(ltrim(S_PRI_LST.X_TXU_CISRATE_PA_CLASS_ELEC)) || '","' ||
rtrim(ltrim(S_ORG_EXT.X_OTH_ACCOUNT_NUMBER)) || '","' ||
rtrim(ltrim(S_ADDR_PER.X_NMI_NUM)) || '","' ||
rtrim(ltrim(S_ADDR_PER.X_NMI_CHECKSUM)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.QUOTE_NUM)) || '","' ||
rtrim(ltrim(S_DOC_QUOTE.X_COOLING_OFF_DATE)) || '","' ||
rtrim(ltrim(a.name)) ||'","'|| --I assume I am still able to right and left trim
rtrim(ltrim(b.name)) ||'","'||
rtrim(ltrim(c.name))||'"' name -- not sure what this name is here for (have ran with and without it here
FROM SIEBEL.S_ADDR_PER S_ADDR_PER,
SIEBEL.S_DOC_QUOTE S_DOC_QUOTE,
SIEBEL.S_EVT_ACT S_EVT_ACT,
SIEBEL.S_ORG_EXT S_ORG_EXT,
SIEBEL.S_PRI_LST S_PRI_LST,
s_prod_int a, -- I assume these needed to go in here
s_prod_int b,
s_prod_int c
SIEBEL.S_QUOTE_ITEM S_QUOTE_ITEM
WHERE S_EVT_ACT.TARGET_OU_ID = S_ORG_EXT.ROW_ID
AND S_DOC_QUOTE.ROW_ID = S_QUOTE_ITEM.SD_ID
AND S_ADDR_PER.ROW_ID = S_ORG_EXT.PR_ADDR_ID
AND S_PROD_INT.ROW_ID = S_QUOTE_ITEM.PROD_ID
AND S_ORG_EXT.ROW_ID = S_DOC_QUOTE.TARGET_OU_ID
AND S_DOC_QUOTE.PRI_LST_ID = S_PRI_LST.ROW_ID
AND S_EVT_ACT.TODO_CD = 'Product Switch-Electricity'
AND S_EVT_ACT.EVT_STAT_CD In ('In Progress','Not Started','On Hold')
AND S_DOC_QUOTE.STAT_CD In ('Completed','Verbal Acceptance','Written Acceptance')
AND S_DOC_QUOTE.X_OFFER_TYPE = 'Product Switch'
AND a.NAME LIKE 'Electricity TRUenergy Business Edge%' --Placed all the where part in the original where clause
OR a.NAME LIKE 'Electricity TRUenergy Business Now%'
OR a.NAME LIKE 'Electricity Go for More%'
OR a.NAME LIKE 'Electricity Mates Rates%'
AND a.row_id = b.row_id
AND (
b.NAME LIKE 'Gas TRUenergy Business Edge%'
OR b.NAME LIKE 'Gas TRUenergy Business Now%'
OR b.NAME LIKE 'Gas Go for More%'
OR b.NAME LIKE 'Gas Mates Rates%'
AND b.row_id = c.row_id
AND (
c.NAME LIKE '%Discount for Paying Your Bill by the Due Date'
NAME -- Not sure what this NAME is for - tried with and without - same error

Similar Messages

  • Stored procedure in  package return multiple columns from multiple tables

    Hi ,
    Can a single stored procedure return multiple column values from different tables.
    example:
    tabA: col2, tabB:col3,tabC:col4 etc.
    one more question:
    if a stored procedure like to return 10 columns for a particular record from a single table do i need to define a TYPE statement for each colum like
    TYPE col1 is TABLE of varchar
    TYPE col2 is TABLE of varchar
    here i want to return only one row, not many rows.
    thanks

    You can try one procedure with OUT or IN/OUT parameters that collect the values from one or more sql statements.
    CREATE OR REPLACE PROCEDURE P1
    (P_COD IN TABLE.COD%TYPE,
    P_DESC1 OUT TABLE1.DESC1%TYPE,
    P_DESC2 OUT TABLE2.DESC2%TYPE)
    IS
    BEGIN
    SELECT table1.DESC1, table2.DESC2
    INTO P_DESC1, P_DESC2
    FROM TABLE1, table2 WHERE
    table1.COD = P_COD and
    table1.cod = table2.cod ;
    END P1;
    JP

  • Return multiple columns from an analytic function with a window

    Hello,
    Is it possible to obtain multiple columns from an analytic function with a window?
    I have a table with 4 columns, an id, a test id, a date, and the result of a test. I'm using an analytic function to obtain, for each row, the current test value, and the maximum test value in the next 2 days like so:
    select
    id,
    test_id,
    date,
    result,
    MAX ( result ) over ( partition BY id, test_id order by date RANGE BETWEEN CURRENT ROW AND INTERVAL '2' DAY FOLLOWING ) AS max_result_next_two_day
    from table
    This is working fine, but I would like to also obtain the date when the max result occurs. I can see that this would be possible using a self join, but I'd like to know if there is a better way? I cannot use the FIRST_VALUE aggregate function and order by result, because the window function needs to be ordered by the date.
    It would be a great help if you could provide any pointers/suggestions.
    Thanks,
    Dan
    http://danieljamesscott.org

    Assuming RESULT is a positive integer that has a maximum width of, say 10,
    and assuming date has no time-component:
    select
       id
      ,test_id
      ,date
      ,result
      ,to_number(substr(max_result_with_date,1,10)) as max_result_next_two_day
      ,to_date(substr(max_result_with_date,11),'YYYYMMDD') as date_where_max_result_occurs
    from (select
            id
           ,test_id
           ,date
           ,result
           ,MAX(lpad(to_char(result),10,'0')||to_char(date,'YYYYMMDD'))
               over (partition BY id, test_id
                     order by date
                     RANGE BETWEEN CURRENT ROW AND INTERVAL '2' DAY FOLLOWING )
            AS max_result_with_date
          from table)

  • Return multiple cursors from one procedure

    Hi,
    I have a stored procedure that is suposed to return multiple records. I know that for each table that I return I have to add a param to the stored procedure, param with ref cursor type.
    I do not know exactly how many tables I have to return, it depends on data from some tables.
    Is it possible to return an unknown number of tables? like an array or something ...
    Please help

    In order to keep it transparent to the developer, I have to translate exactly the stored procedures from SQL Server to Oracle.Well "exactly" is not something that you are going to achieve. You're talking about two disperate languages. That's like saying you want to translate French to English, but it must stay French.
    You obviously want to mimick the existing functionality, but in some cases you're just going to have to bite the bullet and accept that you won't be able to do it totally transparently. In this case, the developers are going to have to make some changes at their end of things too.
    To translate the procedures from T-SQL to Oracle was
    the easiest and most convenient option to the
    developers, so they will not have to write different
    code for Oracle and SQL.But they will. Anyone who evaluated the project and determined that the developers wouldn't need to do anything when moving from one platform to another should be sacked for incompetence.
    ;)

  • Select function that returns multiple columns.

    Currently I have a function that will return 1 column and I can use that in a select statement. What I need is to return multiple columns from a table. In the function I have I return the street address from a table that holds information about dealers, I need to be able to also return the columns that contain the city, state, and zip code so it can be used in an sql select statement. How would I do this?
    My function:
    FUNCTION GET_ADDRESS(dealer_id IN number)
    RETURN tbl_dealer_info.c_street%TYPE AS
    v_rc tbl_dealer_info.c_street%TYPE;
    CURSOR get_dealer_cur IS
    SELECT c_street
    FROM tbl_dealer_info
    WHERE n_dealer_id = dealer_id;
    BEGIN
    v_rc := NULL;
    OPEN get_dealer_cur;
    FETCH get_dealer_cur INTO v_rc;
    IF get_dealer_cur%NOTFOUND THEN
    NULL;
    END IF;
    CLOSE get_dealer_cur;
    RETURN v_rc;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN NULL;
    END GET_ADDRESS;
    My select statement:
    select GET_ADDRESS(1205) Street, DI.n_inactive_flag, DI.n_onhold_flag
    from tbl_dealer_info DI
    where DI.n_dealer_id = 1205;
    I would like to be able to select the street, city, state, and zip all in this select statement from the GET_ADDRESS function.
    Thanks,
    Lori Neirynck

    "The reality is you've probably already put your blinders on and you won't learn the best approach to solving your problem because you insist on asking a courtroom style question (just "yes" or "no" please)."
    Actually, I asked this question because I was looking for the best approach to my problem. I have an SQL statement that correctly selects everything it needs to from all 15 tables. The thing of it is it is very long and difficult to read. I wanted to try using functions so that I could change 12 AND/OR statements into 3 IF statements so everything is easier to read. I have received a couple of different ways to do this from other forums that assumed I knew what I was doing. I have gotten one to work, the other I'm still working on. I'll post the one that worked for others that want to know.
    SQL> insert into dealer_info values (1,'Me','13 success street', 'Wonder Town','Wonderland','1313');
    SQL> commit;
    SQL> create type t_address as object (
    2 street varchar2(100),
    3 city varchar2(30),
    4 state varchar2(30),
    5 zip varchar2(10));
    6 /
    Type created.
    SQL> create or replace function get_address (p_id number) return t_address
    2 is
    3 ret t_address := t_address(null,null,null,null);
    4 rec dealer_info%rowtype;
    5 begin
    6 select * into rec from dealer_info where id=p_id;
    7 ret.street := rec.street;
    8 ret.city := rec.city;
    9 ret.state := rec.state;
    10 ret.zip := rec.zip;
    11 return ret;
    12 end;
    13 /
    Function created.
    SQL> col name format a10
    SQL> col address format a70
    SQL> select name, get_address(id) address from dealer_info;
    NAME ADDRESS(STREET, CITY, STATE, ZIP)
    Me T_ADDRESS('13 success street', 'Wonder Town', 'Wonderland', '1313')
    1 row selected.
    -Lori

  • JDeveloper + WebServices, RETURN multiple rows from pl/sql

    I need to return multiple rows from pl/sql procedure or function and publish it as a Web Service through JDeveloper.
    I try to use ref cursor, but then found that it is impossible to use ref cursor as a return value in Web Services.
    Please, help me to achieve result.

    Hello. I tried to make commands from article, but got errors
    "C:\Program Files\Java\jdk1.6.0_18\bin\java" -jar D:\oracle\Middleware\oracle_common\modules\oracle.webservices_11.1.1\wsa.jar -plsqlAssemble -appName Echo -sql wo -dataSource jdbc/OracleManagedDS -dbConnection jdbc:oracle:thin:@192.168.246.2:1521:data -dbUser syd/manager -style rpc -use encoded
    Error: Interface oracle.generated.wo: The class could not be loaded from the class path.

  • To Move Multiple Files from one directory to another.

    Hi,
    I need to move multiple files from one directory in UNIX (application server ) to another. I need something like an FM 'STRALAN_COPY_FILES' which is also valid in ECC 6.0.
    Thanks in advance.

    Hello Sachin
    Below you see a copy of how to use EPS_FTP_PUT using transaction SE37.
    Import parameters               Value             
    RFC_DESTINATION =                 NONE              
    LOCAL_FILE             =         filename          
    LOCAL_DIRECTORY   =              /dir1/dir2        
    REMOTE_FILE             =        filename          
    REMOTE_DIRECTORY   =             /dir1             
    OVERWRITE_MODE        =          F        " force -> overwrite existing file                 
    TEXT_MODE                    =   B               " binary
    TRANSMISSION_MONITOR            X       " display transmission monitor            
    *RECORDS_PER_TRANSFER            10                
    *REQUESTED_FILE_SIZE             0                 
    *MONITOR_TITLE                                     
    *MONITOR_TEXT1                                     
    *MONITOR_TEXT2                                     
    *PROGRESS_TEXT                                     
    *OBJECT_NAME  
    Regards,
      Uwe

  • Scenario of multiple Asset from one AUC/WBS

    Hello,
    I am having a requirement, where I need to create multiple Asset from one WBS. I checked in the system and able to create more then 1 Asset for WBS.Also if I maintain the distrubution rules for those Asset then settle it accordingly to different Assets.
    I just wanted to confirm, will it we the right way of handling this scenario? My main concern is this involves intervention of user for maintaing the settlement rule during final settlement.
    Is there any other way to handle this scenario?
    Thanks
    Sarang

    Hello Virendra,
    I am not using Investment Managemnt. What do you mean by IM profile?
    I understand that I need to maintain the source of cost in Source structure. But even in that scenario the user has to go and maintain settlement rules and create multiple Asset against one WBS.
    So how do I tackle it, if client requirement is such that they want to create only one AUC, but during final Asset creation they want to create multiple Assets from one AUC. They dont want to have WBS for each Asset.
    Thanks
    Sarang

  • Need help trying to transfer my information from one iphone to another

    need help trying to transfer my information from one iphone to another

    If you are restoring from an icloud backup you are going to have to erase a content and setting and while in the setup prompts you will get the option to restore from an icloud back...that's the only time you will get the option to restore from an icloud back and that's during setup

  • [UIX] How To: Return multiple values from a LOV

    Hi gang
    I've been receiving a number of queries via email on how to return multiple items from a LOV using UIX thanks to earlier posts of mine on OTN. I'm unfortunately aware my previous posts on this are not that clear thanks to the nature of the forums Q&A type approach. So I thought I'd write one clear post, and then direct any queries to it from now on to save me time.
    Following is my solution to this problem. Please note it's just one method of many in skinning a cat. It's my understanding via chatting to Oracle employees that LOVs are to be changed in a future release of JDeveloper to be more like Oracle Forms LOVs, so my skinning skills may be rather bloody & crude very soon (already?).
    I'll base my example on the hr schema supplied with the standard RDBMS install.
    Say we have an UIX input-form screen to modify an employees record. The employees record has a department_id field and a fk to the departments table. Our requirement is to build a LOV for the department_id field such that we can link the employees record to any department_id in the database. In turn we want the department_name shown on the employees input form, so this must be returned via the LOV too.
    To meet this requirement follow these steps:
    1) In your ADF BC model project, create 2 EOs for employees and departments.
    2) Also in your model, create 2 VOs for the same EOs.
    3) Open your employees VO and create a new attribute DepartmentName. Check “selected in query”. In expressions type “(SELECT dept.department_name FROM departments dept WHERE dept.department_id = employees.department_id)”. Check Updateable “always”.
    4) Create a new empty UIX page in your ViewController project called editEmployees.uix.
    5) From the data control palette, drag and drop EmployeesView1 as an input-form. Notice that the new field DepartmentName is also included in the input-form.
    6) As the DepartmentName will be populated either from querying existing employees records, or via the LOV, disable the field as the user should not have the ability to edit it.
    7) Select the DepartmentId field and delete it. In the UI Model window delete the DepartmentId binding.
    8) From the data controls palette, drag and drop the DepartmentId field as a messageLovInput onto your page. Note in your application navigator a new UIX page lovWindow0.uix (or similar) has been created for you.
    9) While the lovWindow0.uix is still in italics (before you save it), rename the file to departmentsLov.uix.
    10) Back in your editEmployees.uix page, your messageLovInput source will look like the following:
    <messageLovInput
        model="${bindings.DepartmentId}"
        id="${bindings.DepartmentId.path}"
        destination="lovWindow0.uix"/>Change it to be:
    <messageLovInput
        model="${bindings.DepartmentId}"
        id="DepartmentId"
        destination="departmentsLov.uix"
        partialRenderMode="multiple"
        partialTargets="_uixState DepartmentName"/>11) Also change your DepartmentName source to look like the following:
    <messageTextInput
        id=”DepartmentName”
        model="${bindings.DepartmentName}"
        columns="10"
        disabled="true"/>12) Open your departmentsLov.uix page.
    13) In the data control palette, drag and drop the DepartmentId field of the DepartmentView1 as a LovTable into the Results area on your page.
    14) Notice in the UI Model window that the 3 binding controls have been created for you, an iterator, a range and a binding for DepartmentId.
    15) Right click on the DepartmentsLovUIModel node in the UI Model window, then create binding, display, and finally attribute. The attribute binding editor will pop up. In the select-an-iterator drop down select the DepartmentsView1Iterator. Now select DepartmentName in the attribute list and then the ok button.
    16) Note in the UI Model you now have a new binding called DCDefaultControl. Select this, and in the property palette change the Id to DepartmentName.
    17) View the LOV page’s source, and change the lovUpdate event as follows:
    <event name="lovSelect">
        <compound>
            <set value="${bindings.DepartmentId.inputValue}" target="${sessionScope}" property="MyAppDepartmentId" />
            <set value="${bindings.DepartmentName.inputValue}" target="${sessionScope}" property="MyAppDepartmentName" />
        </compound>
    </event>18) Return to editEmployees.uix source, and modify the lovUpdate event to look as follows:
    <event name="lovUpdate">
        <compound>
            <set value="${sessionScope.MyAppDepartmentId}" target="${bindings.DepartmentId}" property="inputValue"/>
            <set value="${sessionScope.MyAppDepartmentName}" target="${bindings.DepartmentName}" property="inputValue"/>     
        </compound>
    </event>That’s it. Now when you select a value in your LOV, it will return 2 (multiple!) values.
    A couple things to note:
    1) In the messageLovInput id field we don’t use the “.path” notation. This is mechanism for returning 1 value from the LOV and is useless for us.
    2) Again in the messageLovInput we supply “_uixState” as an entry in the partialTargets.
    3) We are relying on partial-page-refresh functionality to update multiple items on the screen.
    I’m not going to take the time out to explain these 3 points, but it’s worthwhile you learning more about them, especially the last 2, as a separate exercise.
    One other useful thing to do is, in your messageLovInput, include as a last entry in the partialTargets list “MessageBox”. In turn locate the messageBox control on your page (if any), and supply an id=”MessageBox”. This will allow the LOV to place any errors raised in the MessageBox and show them to the user.
    I hope this works for you :)
    Cheers,
    CM.

    Thanks Chris,
    It took me some time to find the information I needed, how to use return multiple values from a LOV popup window, then I found your post and all problems were solved. Its working perfectly, well, almost perfectly.
    Im always fighting with ADF-UIX, it never does the thing that I expect it to do, I guess its because I have a hard time letting go of the total control you have as a developer and let the framework take care of a few things.
    Anyway, I'm using your example to fill 5 fields at once, one of the fields being a messageChoice (a list with countries) with a LOV to a lookup table (id , country).
    I return the countryId from the popup LOV window, that works great, but it doesn't set the correct value in my messageChoice . I think its because its using the CountryId for the listbox index.
    So how can I select the correct value inside my messageChoice? Come to think of it, I dont realy think its LOV related...
    Can someone help me out out here?
    Kind regards
    Ido

  • Add to Multiple Tables from One Page

    Hello,
    I am building an application that handles hardware inventory (APEX 4.0). I have an input page that adds data to two or more tables all at once. The page has two forms on it that point to two separate tables. However when I try to run the page, it fails and returns an error:
    ORA-06550: line 1, column 437: PL/SQL: ORA-00904: "ORH_LAST_UPDATE_DATE": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
         Error      Unable to process row of table IDD_ID_DATA.
    So far as i can see within the App, that column is not at issue (I am not even doing anything to it and it is nullable). I have looked into the App itself as well as doing some online research but have found nothing helpful...
    So my question is this: Is it possible to add to multiple tables from one page? If so how do I do it?
    I am new to APEX so any help would be greatly appreciated!

    UPDATE:
    I received an email from the APEX Support Team:
    "The simple answer is that you will need to manually code the DML (and query) processes if you wish to maintain multiple tables from one page (There is a limit of one table when using the built-in processes).
    In order to do this I suggest you delete the processes generated by the wizards and create PL/SQL processes with insert, update, delete statements as necessary. Such coding is not difficult but is more time consuming than when you can use built-in processes."
    I have been playing around with PL/SQL code and the end result is this:
    begin
         INSERT INTO table1
         VALUES(
              :P2_Item_Field1,
              :P2_Item_Field2);
         INSERT INTO table2
         VALUES(
              :P2_Item_Field1,
              :P2_Item_Field2);
    end;
    I used this code in a custom PL/SQL Process in the Processing>Processes section of Page Processing and it seems to work fine now. The only downside to this method is if the name of a Page Item is changed the code will also have to be changed. Other than that i have had no problems.

  • How to return multiple values from dialog popup

    hi all
    I'm using ADF 10g. I have a requirement that I have to return multiple values from a dialog.
    I have a page containing a table with a button which calls the dialog. The dialog contains a multi-select table where i want to select multiple records and add them to the table in the calling page.
    In the backing bean of the calling page, I have the returnListener method.
    I am thinking that I have to store the selected rows from dialog in an array and return that array to the returnListener...but I don't know how to go about it with the code.
    Can someone help me out with it?
    thanks

    Hi Frank,
    I'm trying to implement your suggestion but getting comfused.
    AdfFacesContext.getCurrentInstance().returnFromDialog(null, hashMap) is called in ActionListener method, from what I understood.
    ReturnListener method already calls it, so no need to call explicitly.
    Okay here's what i'm doing.
    command button launches the dialog on the calling page.
    In the dialog page, there is a button "select", which when i click, closes the dialog and returns to calling page. I put a af:returnActionListener on this button, which logically should have a corresponding ReturnListener() in the calling page backing bean.
    Now I have 3 questions:
    1. do i have to use ActionListener or ReturnListener?
    2. where do I create the hashMap? Is it in the backing bean of the dialog or in the one of calling page?
    3. how do I retrieve the keys n values from hashmap?
    please help! thanks
    This is found in the backing bean of calling page:
    package mu.gcc.dms.view.bean.backing;
    import com.sun.java.util.collections.ArrayList;
    import com.sun.java.util.collections.HashMap;
    import com.sun.java.util.collections.List;
    import java.io.IOException;
    import java.util.Map;
    import javax.faces.application.Application;
    import javax.faces.application.ViewHandler;
    import javax.faces.component.UIViewRoot;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.faces.event.ActionEvent;
    import mu.gcc.dms.model.services.DMSServiceImpl;
    import mu.gcc.dms.model.views.SiteCompaniesImpl;
    import mu.gcc.dms.model.views.SiteCompaniesRowImpl;
    import mu.gcc.dms.model.views.lookup.LkpGlobalCompaniesImpl;
    import mu.gcc.util.ADFUtils;
    import mu.gcc.util.JSFUtils;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.adf.view.faces.context.AdfFacesContext;
    import oracle.adf.view.faces.event.ReturnEvent;
    import oracle.adf.view.faces.model.RowKeySet;
    import oracle.binding.AttributeBinding;
    import oracle.binding.BindingContainer;
    import oracle.binding.OperationBinding;
    import oracle.jbo.AttributeDef;
    import oracle.jbo.Key;
    import oracle.jbo.Row;
    import oracle.jbo.RowIterator;
    import oracle.jbo.RowSetIterator;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.java.util.Iterator;
    public class CompanyList {
    private BindingContainer bindings;
    private Map hashMap;
    DMSServiceImpl service =(DMSServiceImpl)ADFUtils.getDataControlApplicationModule("DMSServiceDataControl");
    SiteCompaniesImpl siteCompanyList = service.getSiteCompanies();
    LkpGlobalCompaniesImpl globalCompanyList = service.getLkpGlobalCompanies();
    public CompanyList() {
    public BindingContainer getBindings() {
    return this.bindings;
    public void setBindings(BindingContainer bindings) {
    this.bindings = bindings;
    *public void setHashMap(Map hashMap) {*
    *// hashMap = (Map)new HashMap();*
    this.hashMap = hashMap;
    *public Map getHashMap() {*
    return hashMap;
    public String searchCompanyButton_action() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding =
    bindings.getOperationBinding("Execute");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    *public void addCompanyActionListener(ActionEvent actionEvent){*
    AdfFacesContext.getCurrentInstance().returnFromDialog(null, hashMap);
    public void addCompanyReturnListener(ReturnEvent returnEvent){
    //how to get hashmap from here??
    public String addCompanyButton_action() {
    return "dialog:globalLovCompanies";
    }

  • Converting multiple columns into one.

    All,
    I have a requirement to convert multiple columns into one. Following is the pseudo code of current implementation. It unions the various columns ( col1, col2........) into a new column new_col. But perforamnce is extrmely slow owing to multiple unions. It may be noted that tables and where conditions of all these queries are same.
    Can you help me create a more efficient query?
    select col1 , col2, col3, col4 from my_tables where some_cols = my_condition;Below is the query used to convert these columns into one.
    select col1 new_col from my_tables where some_cols = my_condition
    union all
    select col2 from my_tables where some_cols = my_condition
    union all
    select col3 from my_tables where some_cols = my_condition
    union all
    select col4 from my_tables where some_cols = my_condition

    Without looking at those things you could be barking up the wrong tree by assuming the issue relates to the unioning of queries or other such things.Well, might be.........
    Execution time of this query (just the execution time not the retrival) is around 34 seconds with connect-by clause for returning 22,000 records.
    Here's the plan
    Execution Plan
    | Id  | Operation                          | Name                        | Rows
    | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT                   |                             |   326
    | 33904 |   135   (2)|
    |   1 |  SORT ORDER BY                     |                             |   326
    | 33904 |   135   (2)|
    |   2 |   MAT_VIEW ACCESS BY INDEX ROWID   | MV_COMQ_RM_DEAL             |     1
    |    62 |     1   (0)|
    |   3 |    NESTED LOOPS                    |                             |   326
    | 33904 |   134   (1)|
    |   4 |     MERGE JOIN CARTESIAN           |                             |   326
    | 13692 |     3   (0)|
    |   5 |      VIEW                          |                             |     1
    |    13 |     2   (0)|
    |   6 |       COUNT                        |                             |
    |       |            |
    |   7 |        CONNECT BY WITHOUT FILTERING|                             |
    |       |            |
    |   8 |         FAST DUAL                  |                             |     1
    |       |     2   (0)|
    |   9 |      BUFFER SORT                   |                             |   326
    |  9454 |     3   (0)|
    |  10 |       TABLE ACCESS BY INDEX ROWID  | SF_SEARCH_IDS_TMP_COMQ      |   326
    |  9454 |     1   (0)|
    |  11 |        INDEX RANGE SCAN            | IDX1_SF_SEARCH_IDS_TMP_COMQ |   349
    |       |     1   (0)|
    |  12 |     INDEX RANGE SCAN               | IDX_MV_COMQ_RM_DEAL         |     9
    |       |     1   (0)|
    -----------------------     Hope, It's readable.......
    I would have posted sample data and query but........I cant do that...:(

  • SELECT in SELECT returning multiple columns ?

    10.2.0.3 version.
    I am trying to tune this query
    SELECT A.EMPLID, A.EFFDT, A.ACAD_PROG,
    (SELECT A1.DESCR FROM PS_ACAD_PROG_TBL A1
    WHERE A1.INSTITUTION = 'AUAO1' AND A1.ACAD_PROG = A.ACAD_PROG AND A1.EFFDT = (SELECT MAX (EFFDT) FROM PS_ACAD_PROG_TBL WHERE INSTITUTION = A1.INSTITUTION AND ACAD_PROG = A1.ACAD_PROG),
    (SELECT A2.DESCRSHORT FROM PS_ACAD_PROG_TBL A2
    WHERE A2.INSTITUTION = 'AUAO1' AND A2.ACAD_PROG = A.ACAD_PROG AND A2.EFFDT = (SELECT MAX (EFFDT) FROM PS_ACAD_PROG_TBL WHERE INSTITUTION = A2.INSTITUTION AND ACAD_PROG = A2.ACAD_PROG),
    as you can see it reading the table PS_ACAD_PROG_TBL two time to get two cloumns DESCR (alias A1) and DESCRSHORT (alias A2) exactly with the same where condition.
    I am trying to replace it with just one select returning multiple columns like this
    SELECT A.EMPLID, A.EFFDT, A.ACAD_PROG,
    (SELECT A1.DESCR, A1.DESCRSHORT FROM PS_ACAD_PROG_TBL A1
    WHERE A1.INSTITUTION = 'AUAO1' AND A1.ACAD_PROG = A.ACAD_PROG AND A1.EFFDT = (SELECT MAX (EFFDT) FROM PS_ACAD_PROG_TBL WHERE INSTITUTION = A1.INSTITUTION AND ACAD_PROG = A1.ACAD_PROG),
    but I am getting ORA-00913: too many values.
    Please help on how to get around this. Thanks in advance.

    William,
    On similar lines I am struggling with the below query based on your suggestions.
    SQL*Plus: Release 9.2.0.1.0 - Production on Wed Aug 5 14:17:21 2009
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> WITH arch_dup AS
      2       (SELECT   a.file_id,
      3                 a.sale_start,
      4                 a.activity_start,
      5                 a.activity_end,
      6                 a.item_code_cust,
      7                 a.division,
      8                 (SELECT MAX (DISTINCT (NVL (b.advertised, 'No')))
      9                    FROM ah_cust_gis_arch_stg b
    10                   WHERE b.file_id = a.file_id
    11                     AND NVL (b.sale_start, 'NULL') = NVL (a.sale_start, 'NULL')
    12                     AND NVL (b.activity_start, 'NULL') = NVL (a.activity_start, 'NULL')
    13                     AND NVL (b.activity_end, 'NULL') = NVL (a.activity_end, 'NULL')
    14                     AND b.item_code_cust = a.item_code_cust
    15                     AND b.division = a.division) advertised,
    16                 COUNT (*)
    17            FROM ah_cust_gis_arch_stg a
    18           WHERE a.file_id = 209
    19             AND a.status_id = 21
    20        GROUP BY a.file_id, a.sale_start, a.activity_start, a.activity_end, a.item_code_cust, a.d
    ivision
    21          HAVING COUNT (*) > 1)
    22  SELECT dup.*,
    23         (SELECT activity_id
    24            FROM (SELECT activity_id,
    25                         ROW_NUMBER () OVER (ORDER BY (activity_retail / activity_mult)) rnk
    26                    FROM ah_cust_gis_arch_stg
    27                   WHERE status_id = 21
    28                     AND NVL (sale_start, 'NULL') = NVL (dup.sale_start, 'NULL')
    29                     AND NVL (activity_start, 'NULL') = NVL (dup.activity_start, 'NULL')
    30                     AND NVL (activity_end, 'NULL') = NVL (dup.activity_end, 'NULL')
    31                     AND item_code_cust = dup.item_code_cust
    32                     AND division = dup.division
    33                     AND file_id = 209
    34                     AND UPPER (NVL (advertised, 'N')) = dup.advertised)
    35           WHERE rnk = 1) activity_id
    36    FROM arch_dup dup;
                       AND UPPER (NVL (advertised, 'N')) = dup.advertised)
    ERROR at line 34:
    ORA-00904: "DUP"."ADVERTISED": invalid identifierCan you throw some light on what to do to make the outer query columns available to inner query?
    Thanks,
    Raj.

  • Return multiple values from a method

    For a school project I have to make a parameter-less constructor that can input values from the keyboard and calculate those values. Now that I have the values how do I return them? I need to return 3 values from this parameter-less method.
    I hoope someone can help.

    Qwertyfshag wrote:
    Here is the wording of the assignment. I have copied and pasted it word for word:
    "Declare and use a no-argument (or "parameter-less") constructor to input the data needed, and to do the calculations."
    Any advice???Find a teacher who isn't an idiot. That sentence is vague ("to input the data needed"? Does that mean that it's supposed to query the user (which is terrible) or that it's supposed to encapsulate the data as hardcoded values, or what?) and is a bad design. Constructors shouldn't do this sort of thing.
    Ok I have done that part and now I want to retrieve the values of the calculations. How can I get those values out of that method What do you mean "that method"? Constructors aren't methods, and they don't return values.
    I suppose you could define a class whose constructor queries the user, and which would have a method to return values. That could be pretty simple; the method signature would be like this:
    Set<Integer> getValues();
    This seems like an advanced problem.It's not advanced; it's just garbage.
    I can't post the code in hear because that may constitute cheating. I am allowed to discuss it verbally but I cannot share code, sorry.You can't get a lot of help then. We can't psychically see what you've done so far.
    In conclusion: I have to have two methods. One method is a constructorConstructors aren't methods. If your teacher told you that they are, then he/she doesn't know what he/she is doing.
    that has NO parameters that will get input from the keyboard (done) and do the calculations (done). The other method must print that values to the screen on separate lines (not done). I don't know how to get the values out of the method.If they're two methods in the same class, then the constructor just needs to store the user input into a field of the class, and the other method can read the values in that field.

Maybe you are looking for