Get each  department wise top 3 salarys

hi..
all
how to get each deprtment wise top 3 salarys in sql

Also, try this
SQL> ed
Wrote file afiedt.buf
  1  select deptno,salary FROM emp e WHERE 3 > (SELECT COUNT(*) FROM emp
  2                                             where salary > e.salary
  3                                             and deptno = e.deptno)
  4* ORDER BY 1,2 desc
SQL> /
    DEPTNO     SALARY
        10      40020
        10      30020
        10      20020
        20     123456
        20      23456
        20      20000
6 rows selected.
SQL>

Similar Messages

  • I'm sure this is a setting fix, but can't find it-.  All of my windows for mac programs open when I turn on my computer, such that I have to close each one individually to get to my desk top.  How do I adjust so none of them open unless I choose to?

    I'm sure this is a setting fix, but can't find it….  All of my windows for mac programs open when I turn on my computer, such that I have to close each one individually to get to my desk top.  How do I adjust so none of them open unless I choose to?

    Remove the check in the box "Reopen windows when logging back in":

  • How to get all records from department wise having max salary?

    i have a Employee table which consist
    id | name | dept_id | Salary
    1 A 1 20
    2 B 1 25
    3 C 2 30
    4 D 2 25
    Search max salary department wise with all details like below result.
    id | name | dept_id | Salary
    2 B 1 25
    3 C 2 30

    Could you try this?
    create table employee (id int, name varchar(10), dept_id int, salary int)
    insert into employee values (1,'A',1,20)
    insert into employee values (2,'B',1,25)
    insert into employee values (3,'C',2,30)
    insert into employee values (4,'D',2,25)
    select e.* from employee e inner join
    (select a.dept_id , max (a.salary) as 'max_salary' from employee a
    group by a.dept_id ) b
    on e.dept_id = b.dept_id
    and e.salary = b.max_salary
    order by e.dept_id
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Vendor  & GL Account Balance - department wise

    Hi All,
    We have a requirement from the client to show the Vendor Account Balance department wise. The scenario is like this.
    A single Vendor is operated by different sections of the Finance department like Raw Materials Bill passing section, Stores Bill passing Section, Works Bills Section, Operations Bill Section, Project Accounts Section etc
    Each section has authorisation to posts the document in that vendor account and is responsible for the document it posts. Client wants to know how much balance is outstanding to/from the Vendor each section wise.
    I think it is not practical to create separate Profit Centers for all the sections in the Finance department since there are many sections in the Finance department.
    Please let me know how to address this issue.
    Regards,
    Hari

    Hi Ravi,
    Thanks for your reply.
    Client is not accepting any manual entry of section code.
    He insists that either system should automatically derive the section name or there should be an option for the user to select the section code through F4 selection.
    Regards..
    Hari

  • Forecast by each day wise

    Hi,
    I got a requirement to do a forecast on the stock values.
    I have created a Real-Time InfoCube  in which the daily stock Issues and Receipt values are update from the Stock InfoCube  which are actual Values.
    I need to create a Ready-input query doing forecast values based on each day wise of the current month.
    The business case is..assume that today date is 10th of the current month.
    The report should display the actual values from 1 - 10th  and from 11 to last day of the current month it need to be ready-input query to enter the values.
    How to get the each day as column of the current month and how do we restrict the actual and forecast values at each  column.
    Please advice how to meet the requirement.
    Regards
    Jagannadha Raju

    Hi David,
    Thanks for the reply and for your time...
    i want to explain in little bit.
    My stock cube contains the data only upto day (10th). if i put cal day in the column it is display the only upto 10th day. But it should display the columns from 11 to 31 as input query also.
    Please advice on this... even if we don't have data also how would we display all the days as columns.
    Regards
    Jagannadha Raju

  • How to get each column position in JTable?

    I want some buttons appear at the top of each column. For example,
      Button1    Button2  Button3
    | column1 | column2 | column3 |
    |--------------------------------------------|
    ...But button1,2 and 3 should be at the top of the column1, 2 and 3. So the problem is that how can I get each column's position.

    gajesh wrote:
    To get column index using column heading name, use following:-
    table.getColumnModel().getColumnIndex(columnName)You should use your own TableCellRenderer for header column:
    MyButtonHeaderRenderer extends JButton implements TableCellRenderer {
    <class definition>
    then you can set user-defined renderer to header column:-
    getColumnModel().getColumn(colIndex).setHeaderRenderer(new MyButtonHeaderRenderer());
    But the button is outside of the JTable. It is on the top of the Table. So I don't think implementing HeaderRender works here.
    I need to know each column's position (x,y) and place the button on the top of the columns.

  • Result recording Department Wise

    Hi Gurus
    I want make result recording according to the department wise.
    Eg.
    [ Purchase requestation is given by different department so the corresponding department QC should result record the inspection]
    How can map the scenario in SAP
    Thanks in advance

    Hi Srinivasan
        In your case you can maintain operations department wise in inspection plan.so that they can do the result recording department wise.
    For each operation you can maintain seperate inspection characteristics(Department wise).
    thanks
    S.Murali

  • Need to display average percent of spend for each vendor in top ten

    Hi Friends,
                 I have to design a query where  I need to display top ten vendors and for that top ten vendors  need to sum the AMT and I have to calculate the average percentage of each vendor in top ten list from the total. Based and the specified range have to create exceptions.
    I am able to display top ten vendors. Now the problem is unable to calculate total of top ten vendors and average percentage of each vendor from total. like the below
         spend     Spend Ratio     Spend Percentage     
    vendor 4     121987     0.299181333     30%     80% is an A
    vendor 10     101103     0.247961917     55%     
    vendor 8     98723     0.242124806     79%     
    vendor 9     23456     0.05752742     85%     80-95% is a B
    vendor 5     12345     0.030276944     88%     
    vendor 6     10540     0.02585006     90%     
    vendor 7     9906     0.024295132     93%     
    vendor 3      9903     0.024287774     95%     95-100% is a C
    vendor 2     9899     0.024277964     98%     
    vendor 1     9874     0.02421665     100%     
    Total     407736               
    Please, suggest me to proceed further.
    Thank You.
    Manjula

    Hi manjula
    In order to get total for any key figure .... for that key figure at the query level in the  calculation tab there will be one box like calculate result as there u give sum or average accroding to ur purpose... then it will display the total or average accordingly....
    the key figure when used average for result shows average of all record conrtibutions but
    In order to display the  percentage of each vendor from total u can use
    Percentage Share of Result (%CT)
    %CT<Operand>
    Specifies how high the percentage share is in relation to the result. The result
    means the result of aggregation at the next level (interim result).
    %CT Incoming Orders specifies the share of incoming order values of each
    individual characteristic value (for example of each customer) in relation to
    the characteristic's result (for example, customer of a division).
    Regards
    vamsi

  • I get each email 3 times

    I have just set up my iphone.
    I am receiving my emails from my outlook account, but get each email 3 times?

    Sorry - I changed this message once I saw that you were trying to sign onto iCloud.com....
    Go into Safari and under Safari (top menu) Preferences>Privacy click on the "Details" button next to Cookies and other Website data. Scroll down the list until you find iCloud.com, select it, and then click on Remove.
    Reboot your Mac, then go to iCloud.com and try to sign in again. Be sure to type in the password - don't let it prefill.
    Cheers,
    GB

  • After i updated to IOS6 my wife and i keep getting each others imessages.

    after i updated to IOS6 my wife and i keep getting each others imessages.

    This is caused by using the same Apple ID for iMessage.  To prevent this you need to use separate IDs.  (You can continue to use the same ID for purchasing; it does not need to be the same as the one used for other services such as iMessage.)
    On the phone that will be changing, go to Settings>Messages>Send & Receive, tap the Apple ID at the top, sign out, sign back in with a different ID.

  • Can my family use 'find my iphone' for each other if we each have separate apple ids? recently had to create separate ones b/c we were getting each others texts/facetimes and i read this happens when you share an apple id.

    Can my family still use the 'find my iphone' app from our iphones / ipod touch to locate each others phone if we have separate apple ids?  We were sharing a single apple id but recently we started getting each others texts/facetimes .. I read that this happens when you share an apple id.  Will we just have to sign in with the others' apple id to locate their phone ?

    Use Find My Friends app instead.   Much easier to manage, and you won't need each other's id/pw's to do it.   They only need to accept your invitations and vice versa.

  • How to get each value from a parameter passed like this '(25,23,35,1)'

    Hi
    One of the parameter passed to the function is
    FUNCTION f_main_facility(pi_flag_codes VARCHAR2) return gc_result_set AS
    pi_flag_codes will be passed a value in this way '(25,23,35,1)'
    How to get each value from the string
    like 25 first time
    23 second time
    35 third time
    1 fourth time
    I need to build a select query with each value as shown below:-
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3, code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 25 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q1,
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3,code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 23 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q2,
    (SELECT t2.org_id, RTRIM(xmlagg(xmlelement(e, t4.description || ';')
    ORDER BY t4.description).EXTRACT('//text()'), ';') AS DESCRIPTION
    from org_name t2, ref_org_name t3,code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 35 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date
    group by t2.org_id) q3,
    (SELECT t2.org_id, t4.description
    from org_name t2, ref_org_name t3, code_table t4
    where t2.att_data = t4.code
    and t3.ref_code = t2.att_type
    and t2.att_type = 1 and t3.code_type = t4.code_type
    and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q4
    Please help me with extracting each alue from the parm '(25,23,35,1)' for the above purpose. Thank You.

    chris227 wrote:
    I would propose the usage of regexp for readibiliy purposes and only in the case if this doesnt perform well, look at solutions using substr etc.
    select
    regexp_substr( '(25,23,35,1)', '\d+', 1, 1) s1
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 2) s2
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 3) s3
    ,regexp_substr( '(25,23,35,1)', '\d+', 1, 4) s4
    from dual 
    S1     S2     S3     S4
    "25"     "23"     "35"     "1"In pl/sql you do something like l_val:= regexp_substr( '(25,23,35,1)', '\d+', 1, 1);
    If t2.att_type is type of number you will do:
    t2.att_type= to_number(regexp_substr( '(25,23,35,1)', '\d+', 1, 1))Edited by: chris227 on 01.03.2013 08:00Sir,
    I am using oracle 10g.
    In the process of getting each number from the parm '(25,23,35,1)' , I also need the position of the number
    say 25 is at 1 position.
    23 is at 2
    35 is at 3
    1 is at 4.
    the reason I need that is when I build seperate select for each value, I need to add the query number at the end of the select query.
    Please see the code I wrote for it, But the select query is having error:-
    BEGIN
    IF(pi_flag_codes IS NOT NULL) THEN
    SELECT length(V_CNT) - length(replace(V_CNT,',','')) FROM+ ----> the compiler gives an error for this select query : PLS-00428:
    *(SELECT '(25,23,35,1)' V_CNT  FROM dual);*
    DBMS_OUTPUT.PUT_LINE(V_CNT);
    -- V_CNT := 3;
    FOR L_CNT IN 0..V_CNT LOOP
    if L_CNT=0 then
    V_S_POS:=1;
    V_E_POS:=instr(pi_flag_codes, ',', 1, 1)-1;
    else
    V_S_POS:=instr(pi_flag_codes,',',1,L_CNT)+1;
    V_E_POS:=instr(pi_flag_codes, ',', 1, L_CNT+1)-V_S_POS;
    end if;
    if L_CNT=V_CNT then
    V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS));
    else
    V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS,V_E_POS));
    end if;
    VN_ATYPE := ' t2.att_type = ' || V_ID;
    rec_count := rec_count +1;
    query_no := 'Q' || rec_count;
    Pls help me with fetching each value to build the where cond of the select query along with the query number.
    Thank You.

  • How to get latest record on top of the result list

    Hi Gurus,
    How to get latest record on top of the result list when you open the record.
    saved data method in BT120H_CPL of OverView page and result list in ICCMP_INBOX.
    Regards,
    Ravi

    Hi
    Try sort descending by on fileld "changed at ".
    manipulate the sort depends on your requirement
    Regards
    Logu

  • How to split a varchar parameter say (2,4,7,24) and get each of the value

    Hi
    I have to create a function which takes in 2 paramters,
    first one is date
    second one is a list of codes within parentheses (varchar2) ex:- '(2,4,7,24)'
    Each of this number value brings out a table information such as
    table name
    where condition
    start and end dates and soon
    I need to build a dynamic SQL ..for each table information got from each value.
    In this case, their will be 4 select queries which needs to be joined.
    To start of, I want to know, how many codes have been passed in the second parm.
    Please let me know, if their is a function which contains the number of delimiters and a function which can be used to get each value
    basically from (2,4,7,24)
    I want
    the count of delimiters (here it is 3)
    using the count of delimiters (3+1 , will be giving me the count of numbers present)
    using the delimiter, I want to get each number
    ie.,
    2 first time and create the SQL
    4
    7
    24
    Atlast will join all 4 sql queries and create one which runs to produce my output
    Thank You
    I appreciate your help

    Sir,
    I did the same think, what you have posted, but I want some simpler way, and I dont know how to do it.
    create or replace
    PACKAGE BODY PKG_EXTRACT_FACILITY AS
    -- GET THE FACILITY INFO FOR A GIVEN YEAR .
    FUNCTION F_MAIN_FACILITY(PI_DATE DATE,PI_ORGEXT_ID varchar2) RETURN GC_RESULT_SET AS
    C_RESULT_SET GC_RESULT_SET;
    VN_TABLE VARCHAR2(20);
    VN_COLUMN VARCHAR2(40);
    VN_WHERE VARCHAR2(20);
    VD_START VARCHAR2(40);
    VD_END VARCHAR2(40);
    VN_MULTI NUMBER(2);
    VN_SQL VARCHAR2(4000);
    VC_QUERY VARCHAR2(2000);
    BEGIN
    DBMS_OUTPUT.PUT_LINE(PI_ORGEXT_ID);
    DBMS_OUTPUT.PUT_LINE(''''|| PI_ORGEXT_ID ||'''');
    --VN_SQL := 'SELECT REPLACE(' PI_ORGEXT_ID ','"' ,'') FROM dual' ;
    --DBMS_OUTPUT.PUT_LINE(VN_SQL);
    --PI_ORGEXT_ID := EXECUTE IMMEDIATE(VN_SQL);
    OPEN C_RESULT_SET FOR
    --SELECT ORGEXT_TABLE,count(*), ORGEXT_COLUMN, ORGEXT_WHERE,
    -- ORGEXT_START, ORGEXT_END, ORGEXT_MULTI
    -- FROM ORG_EXTRACT
    -- WHERE ORGEXT_ID IN
    -- (SELECT regexp_substr(''''|| PI_ORGEXT_ID ||'''','[^,]+', 1, level) from dual connect by regexp_substr(''''|| PI_ORGEXT_ID ||'''', '[^,]+', 1, level) is not null )
    -- group by ORGEXT_TABLE, ORGEXT_COLUMN, ORGEXT_WHERE,
    -- ORGEXT_START, ORGEXT_END, ORGEXT_MULTI;
    --SELECT ORGEXT_ID,ORGEXT_TABLE, ORGEXT_COLUMN, ORGEXT_WHERE,
    -- ORGEXT_START, ORGEXT_END, ORGEXT_MULTI
    -- FROM ORG_EXTRACT
    -- WHERE INSTR(''''|| PI_ORGEXT_ID ||'''',ORGEXT_ID) > 0 ORDER BY ORGEXT_ID;
    SELECT ORGEXT_TABLE, ORGEXT_COLUMN, ORGEXT_WHERE,
    ORGEXT_START, ORGEXT_END, ORGEXT_MULTI
    FROM ORG_EXTRACT
    WHERE ORGEXT_ID IN
    (SELECT * FROM TABLE(in_list(PI_ORGEXT_ID)));
    -- DBMS_OUTPUT.PUT_LINE(VN_SQL);
    LOOP
    FETCH C_RESULT_SET INTO VN_TABLE, VN_COLUMN, VN_WHERE, VD_START, VD_END, VN_MULTI;
    EXIT WHEN C_RESULT_SET%NOTFOUND;
    -- dbms_output.put_line('record '|| VN_TABLE || ' ' || VN_COLUMN );
    IF ( VN_MULTI > 0 ) THEN
    IF ( VD_START IS NULL AND VN_WHERE IS NOT NULL ) THEN
    --SELECT QUERY WITH XML FUNC NOT INCLUDING START AND END DATES.
    VC_QUERY := 'SELECT ORG_MAIN.ORG_ID, Q1.' || VN_COLUMN || '
    FROM ORG_MAIN,
    (SELECT ORG_ID, RTRIM(XMLAGG(XMLELEMENT(E, ' || VN_COLUMN || ' || '','')
    ORDER BY ' || VN_COLUMN || ').EXTRACT(''//text()''), '','') AS ' || VN_COLUMN || '
    FROM ' || VN_TABLE || '
    WHERE ' || VN_WHERE || '
    GROUP BY ORG_ID) Q1
    WHERE M.ORG_MAIN.ORG_ID = Q1.ORG_ID(+)
    ORDER BY ORG_ID';
    DBMS_OUTPUT.PUT_LINE('FIRST CONDITION ' || VC_QUERY);
    EXECUTE IMMEDIATE VC_QUERY;
    ELSIF ( VD_START IS NULL AND VN_WHERE IS NULL ) THEN
    --SELECT QUERY WITH XML FUNC INCLUDING START AND END DATES.
    VC_QUERY := 'SELECT ORG_MAIN.ORG_ID, Q1.' || VN_COLUMN || '
    FROM ORG_MAIN,
    (SELECT ORG_ID, RTRIM(XMLAGG(XMLELEMENT(E, ' || VN_COLUMN || ' || '','')
    ORDER BY ' || VN_COLUMN || ').EXTRACT(''//text()''), '','') AS ' || VN_COLUMN || '
    FROM rateprep.' || VN_TABLE || '
    GROUP BY ORG_ID) Q1
    WHERE ORG_MAIN.ORG_ID = Q1.ORG_ID(+)
    ORDER BY ORG_ID';
    DBMS_OUTPUT.PUT_LINE('SECOND CONDITION ' || VC_QUERY);
    EXECUTE IMMEDIATE VC_QUERY;
    ELSIF ( VD_START IS NOT NULL AND VN_WHERE IS NOT NULL ) THEN
    --SELECT QUERY WITH XML FUNC INCLUDING START AND END DATES, BUT NOT INCLUDING WHERE CLAUSE.
    VC_QUERY := 'SELECT ORG_MAIN.ORG_ID, Q1.' || VN_COLUMN || '
    FROM ORG_MAIN,
    (SELECT ORG_ID, RTRIM(XMLAGG(XMLELEMENT(E, ' || VN_COLUMN || ' || '','')
    ORDER BY ' || VN_COLUMN || ').EXTRACT(''//text()''), '','') AS ' || VN_COLUMN || '
    FROM ' || VN_TABLE || '
    WHERE ' || VN_WHERE || ' AND
    (TO_DATE( ' ||''''|| PI_DATE ||''''|| ', ''DD-MON-YY'') BETWEEN ' ||''|| VD_START ||''|| ' AND ' ||''|| VD_END ||''|| ')
    GROUP BY ORG_ID) Q1
    WHERE ORG_MAIN.ORG_ID = Q1.ORG_ID(+)
    ORDER BY ORG_ID';
    DBMS_OUTPUT.PUT_LINE('THIRD CONDITION ' || VC_QUERY);
    EXECUTE IMMEDIATE VC_QUERY;
    ELSIF ( VD_START IS NOT NULL AND VN_WHERE IS NULL ) THEN
    --SELECT QUERY WITH XML FUNC INCLUDING START AND END DATES, AND INCLUDING WHERE CLAUSE.
    VC_QUERY := 'SELECT ORG_MAIN.ORG_ID, Q1.' || VN_COLUMN || '
    FROM ORG_MAIN,
    (SELECT ORG_ID, RTRIM(XMLAGG(XMLELEMENT(E, ' || VN_COLUMN || ' || '','')
    ORDER BY ' || VN_COLUMN || ').EXTRACT(''//text()''), '','') AS ' || VN_COLUMN || '
    FROM ' || VN_TABLE || '
    WHERE (TO_DATE( ' ||''''|| PI_DATE ||''''|| ', ''DD-MON-YY'') BETWEEN ' ||''|| VD_START ||''|| ' AND ' ||''|| VD_END ||''|| ')
    GROUP BY ORG_ID) Q1
    WHERE ORG_MAIN.ORG_ID = Q1.ORG_ID(+)
    ORDER BY ORG_ID';
    DBMS_OUTPUT.PUT_LINE('FOURTH CONDITION ' || VC_QUERY);
    EXECUTE IMMEDIATE VC_QUERY;
    END IF;
    ELSE
    IF ( VD_START IS NULL AND VN_WHERE IS NOT NULL ) THEN
    --SELECT QUERY WITHOUT XML FUNC AND WITHOUT START AND END DATES.
    VC_QUERY := 'SELECT ORG_MAIN.ORG_ID, Q1.' || VN_COLUMN || '
    FROM ORG_MAIN,
    ( SELECT ORG_ID, ' || VN_COLUMN || '
    FROM ' || VN_TABLE || '
    WHERE ' ||VN_WHERE || '
    ) Q1
    WHERE M.ORG_MAIN.ORG_ID = Q1.ORG_ID(+)
    ORDER BY ORG_ID';
    DBMS_OUTPUT.PUT_LINE('FIFTH CONDITION ' || VC_QUERY);
    EXECUTE IMMEDIATE VC_QUERY;
    ELSIF ( VD_START IS NULL AND VN_WHERE IS NULL ) THEN
    --SELECT QUERY WITHOUT XML FUNC AND WITHOUT WHERE CLAUSE AND START AND END DATES.
    VC_QUERY := 'SELECT ORG_MAIN.ORG_ID,Q1.' || VN_COLUMN || '
    FROM ORG_MAIN,
    ( SELECT ORG_ID, ' || VN_COLUMN || '
    FROM ' || VN_TABLE || '
    ) Q1
    WHERE ORG_MAIN.ORG_ID = Q1.ORG_ID(+)
    ORDER BY ORG_ID';
    DBMS_OUTPUT.PUT_LINE('SIXTH CONDITION ' || VC_QUERY);
    EXECUTE IMMEDIATE VC_QUERY;
    ELSIF ( VD_START IS NOT NULL AND VN_WHERE IS NOT NULL ) THEN
    VC_QUERY := 'SELECT ORG_MAIN.ORG_ID,Q1.' || VN_COLUMN || '
    FROM ORG_MAIN,
    ( SELECT ORG_ID, ' || VN_COLUMN || '
    FROM ' || VN_TABLE || '
    WHERE ' || VN_WHERE || ' AND
    (TO_DATE( ' ||''''|| PI_DATE ||''''|| ', ''DD-MON-YY'') BETWEEN ' ||''|| VD_START ||''|| ' AND ' ||''|| VD_END ||''|| ')
    ) Q1
    WHERE ORG_MAIN.ORG_ID = Q1.ORG_ID(+)
    ORDER BY ORG_ID';
    DBMS_OUTPUT.PUT_LINE('SEVENTH CONDITION ' || VC_QUERY);
    EXECUTE IMMEDIATE VC_QUERY;
    ELSIF ( VD_START IS NOT NULL AND VN_WHERE IS NULL ) THEN
    VC_QUERY := 'SELECT ORG_MAIN.ORG_ID,Q1.' || VN_COLUMN || '
    FROM ORG_MAIN,
    ( SELECT ORG_ID, ' || VN_COLUMN || '
    FROM ' || VN_TABLE || '
    WHERE TO_DATE( ' ||''''|| PI_DATE ||''''|| ', ''DD-MON-YY'') BETWEEN ' ||''|| VD_START ||''|| ' AND ' ||''|| VD_END ||''|| '
    ) Q1
    WHERE ORG_MAIN.ORG_ID = Q1.ORG_ID(+)
    ORDER BY ORG_ID';
    DBMS_OUTPUT.PUT_LINE('EIGHTH CONDITION ' || VC_QUERY);
    EXECUTE IMMEDIATE VC_QUERY;
    END IF;
    END IF;
    -- VC_SQL := 'SELECT ORG_MAIN.ORG_ID,' ||
    -- VC_EXT :=
    END LOOP;
    OPEN C_RESULT_SET FOR VC_QUERY;
    RETURN C_RESULT_SET;
    CLOSE C_RESULT_SET;
    END F_MAIN_FACILITY;
    FUNCTION in_list (p_in_list  IN  VARCHAR2) RETURN t_in_list_tab PIPELINED
    AS
    l_text  VARCHAR2(32767) := p_in_list || ',';
    l_idx   NUMBER;
    BEGIN
    LOOP
    l_idx := INSTR(l_text, ',');
    EXIT WHEN NVL(l_idx, 0) = 0;
    PIPE ROW (TRIM(SUBSTR(l_text, 1, l_idx - 1)));
    l_text := SUBSTR(l_text, l_idx 1);+
    END LOOP;
    RETURN;
    END;
    END PKG_EXTRACT_FACILITY;
    SET SERVEROUTPUT ON;
    Declare
    VC_OUT NUMBER;
    VC_OUT1 VARCHAR2(80);
    VC_RES PKG_EXTRACT_FACILITY.GC_RESULT_SET;
    begin
    VC_RES := PKG_EXTRACT_FACILITY.F_MAIN_FACILITY('01-JAN-10','9,2,3');
    LOOP
    fetch VC_RES INTO VC_OUT,VC_OUT1;
    EXIT WHEN VC_RES%NOTFOUND;
    dbms_output.put_line('data ' || VC_OUT ||' ' || VC_OUT1 );
    END LOOP;
    close VC_RES;
    end;
    The function I wrote, right now is at building each Select query from each result record produced from passing the second parm to the select query to extract all other table information from
    ORG_EXTRACT table.
    Any help to solve the business role I wrote in my earlier mail, is appreciated.Thank You.
    Edited by: user8703472 on Sep 21, 2012 7:37 AM
    Edited by: user8703472 on Sep 21, 2012 7:40 AM
    Edited by: user8703472 on Sep 21, 2012 7:44 AM
    Edited by: user8703472 on Sep 21, 2012 7:44 AM
    Edited by: user8703472 on Sep 21, 2012 7:46 AM

  • We have 3 kids with ipods, all on one apple id and they complain that they get each others messages, apps etc.  what can I do to change this?

    We have 3 kids with an ipod touch each.  All are on one apple id (mine, so they have to come to me to authorise purchases) and they complain that they get each others messages, apps etc.  What can I do to set this up differently, so they can each manage their own content etc but not make purchases?

    Go onto all iPods, and turn on "Restrictions" and disable installing apps. The apps do auto download, and the only way around the messages problem is to make 3 Apple IDs. When installing apps, it will ask for a "restrictions" password, and you can enter that.

Maybe you are looking for

  • Source system in Development & Quality & Production

    Dear Experts, Normally we do developments in Development server,so we create source system connection to R3 Development server (say 120) and create DataSources, DTP and process chains based on the Source system 120. Now my Doubt is when we transport

  • PDF too big to open?

    I have a brand new 2GB computer and have been making a pdf using Acrobat 8 Standard. Its 235MB and now its too big for me to do anything with it! It won't even load up anymore because its so huge. Any suggestions on anything I can do?

  • File transfer status in rxvt-unicode?

    Hello, I had mounted a cifs and had been copying some movies from one of my computers to another through the terminal (mount -t cifs comp1:/share/ ~/somemntpoint) and I realized that I had no idea about the status of the file transfer.  Is there an a

  • Regarding function module "ISM_INC_PAYMENT_PROCESSING"

    Hi, can anyone let me know about function module "ISM_INC_PAYMENT_PROCESSING" in detail. it's main functionality n purpose.

  • Jdeveloper: Tool Preferences Code Editor Save Actions. Why no code format?

    For me Format and Organize Imports are the 2 main save actions? Can I write a plugin or something to have the code format working for me? Best Regards, JP