Group by a substring

Hi All,
Oracle 11.2.0
I have the following table, is there a way I can get the average age of all the names with LN:SMITH.
In other words I want to regexp parsing and grouping using sql
create table test_table (
age number,
names varchar2(500));
insert into test_table (age,names) values(20,'FN:John,LN:Smith');
insert into test_table (age,names) values(30,'FN:Sam,LN:Blair');
insert into test_table (age,names) values(40,'FN:Will,LN:Smith');
insert into test_table (age,names) values(50,'FN:Sam,LN:Smith');
insert into test_table (age,names) values(60,'FN:Peter,LN:Lloyd');
insert into test_table (age,names) values(70,'FN:John,LN:Blair');
insert into test_table (age,names) values(80,'FN:Ann,LN:Smith');
Thanks in advance
__Pete

Hi All,
I need to slightly modify this query, for egs: in this table
create table test_table (
age number,
names varchar2(500));
insert into test_table (age,names) values(20,'FN:John,MN:Mid1,LN:Smith');
insert into test_table (age,names) values(30,'FN:Sam,MN:Mid2,LN:Blair');
insert into test_table (age,names) values(40,'FN:Will,MN:Mid1,LN:Smith');
insert into test_table (age,names) values(50,'FN:Sam,MN:Mid2,LN:Smith');
insert into test_table (age,names) values(60,'FN:Peter,MN:Mid1,LN:Lloyd');
insert into test_table (age,names) values(70,'FN:John,MN:Mid2,LN:Blair');
insert into test_table (age,names) values(80,'FN:Ann,MN:Mid1,LN:Smith');
commit;
I want to get average age for all the users with same middle name ('MN:'). I tried modifying the above query, but I am not able to display the correct middle name , any one has any thoughts ?
Thanks
_pete                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • GROUP BY in Desktop Intelligence

    Question: Is there a way to use GROUP BY statement at the Universe level?
    Detailed Example: I have Cricket Teams and Team Members. I want to display all the team members for a team in a single cell as comma separated values. At database level, I can achieve this by using an oracle function (stringagg) as follows:
    SELECT Team, stringagg(Team_Members)
    FROM Cricket_Team
    GROUP BY Team
    In Business Objects Universe, I have created two objects:
    1> Team as Cricket_Team.Team
    2> Team Members as stringagg(Team_Members)
    When I drag these two objects in the report I get DA0005 error (Exception: DBD, ORA-00937: not a single-group group function
    State: N/A)
    This is because the SQL generated by Desktop Intelligence is
    SELECT Team, stringagg(Team_Members)
    FROM Cricket_Team
    I can fix this at reporting level by customizing the SQL, but I want this to be fixed at the Universe level so that all the users can get the Team_Members list in comma separated values for each Team.
    So, is there a way to get this GROUP BY Team statement at the Universe level?

    Hello,
    You cannot do this in the universe.
    As we are using BO6.5 the solution written below is based on that, but because deski hasn't changed much since then it still might work the same (but you need to check for yourself).
    What you can do is adjust the prm-file (parameter file) for Oracle (oracle.prm).
    You can find it in the folder (=our default installation folder for BO6.5): C:\Program Files\Business Objects\BusinessObjects Enterprise 6\dataAccess\RDBMS\connectionServer\oracle
    In the file the functions are listed which generate a GROUP BY.
    <Function Group="False" ID="Substring" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>substr($1,$2,$3)</SQL>
    </Function>
    <Function Group="True" ID="Sum" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>sum($1)</SQL>
    </Function>
    Above 2 examples from the oracle.prm file whe 'Substring' will not generate a GROUP BY and 'Sum' will.
    What you could do is add the 'stringagg' function (after making a copy of the original oracle.prm file) and see if it works.
    Regards,
    Harry

  • Sql  + group by

    Is there any way to use group by 1,2,3 or group by column aliases just like order by?
    This works
    select dbid, substr(id,9) || substr(SR_Type,1,1) as SR
    from S
    group by dbid, substr(id,9) || substr(SR_Type,1,1)
    But I don't like to repeat all statements of select in group by.
    I'd like to have
    select dbid, substr(id,9) || substr(SR_Type,1,1) as SR
    from S
    group by 1,2
    or
    select dbid, substr(id,9) || substr(SR_Type,1,1) as SR
    from S
    group by dbid, SR
    But it seems like neither works. Any input?
    Thanks in advance

    You can use column aliases with the following constructs:
    -- Example without aliases
    select deptno, job, count(*)
    from emp
    group by deptno, job;
    -- Example using inline view
    select d, j, count(*)
    from ( select deptno d, job j
           from emp
    group by d, j
    -- Example using 9i 'with' feature
    with alias as
    (select deptno d, job j from emp)
    select d, j, count(*)
    from alias
    group by d, j;

  • Bin grouping probllem

    I have the following code
    WITH a AS ( SELECT ( LEVEL * 100 ) + LEVEL r
    FROM DUAL
    CONNECT BY LEVEL < 500)
    SELECT MIN ( r ) minn
    ,MAX ( r ) maxn
    ,MAX ( r ) - MIN ( r ) gdiff
    ,TO_NUMBER ( SUBSTR ( r, 1, 1 ) ) * POWER ( 10, LENGTH ( TRIM ( TO_CHAR ( r ) ) ) - 1 ) gseg
    FROM a
    GROUP BY TO_NUMBER ( SUBSTR ( r, 1, 1 ) ) * POWER ( 10, LENGTH ( TRIM ( TO_CHAR ( r ) ) ) - 1 )
    ORDER BY gseg;
    for the rows I get back I am trying to do the following.
    I want to break down strarting frmo the leftmost digit to th riight most digit in each group I want to get common values ranges.
    For Example:
    if my range looks like
    10,19,9,10
    I would be able to get just 1 as a result because all 10,11,12,13,14,15,16,17,18,19 start with a 1 and the whole range is covered. this the smallest common number I get.
    If I had a row like
    20,24,4,20
    I would see that this is only 20,21,22,23,24 and so have all five rows because the range is not complete.
    if I have a row like
    1000,1700,700,1000
    I would like rows liek 100,110,120,130,140,150,160,1700.
    1700 is 4 digits because it does not have a complete range for 17xx.
    All help is appreciated.

    Hi,
    Hi,
    Whenever you have a question, it helps to post:
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables. In this case, I'm not sure the 3 sets you already mentioned give a very clear picture of what you want. Maybe you should add a few more examples.
    (3) The results you want from that data
    (4) Your best attempt so far (formatted)
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    Formatted tabular output is okay for (3). Type these 6 characters:
    &#123;code&#125;
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    smklad wrote:
    if my range looks like
    10,19,9,10
    I would be able to get just 1 as a result because all 10,11,12,13,14,15,16,17,18,19 start with a 1 I'm confused. 9 doesn't start with 1.
    If I had a row like
    20,24,4,20
    I would see that this is only 20,21,22,23,24 and so have all five rows because the range is not complete.What part does 4 play in this result? If none, why not?
    if I have a row like
    1000,1700,700,1000
    I would like rows liek 100,110,120,130,140,150,160,1700.
    1700 is 4 digits because it does not have a complete range for 17xx.Why are all the numbers in the output smaller than any of the numbers in the input? It seems like most of them were divied by 10. Why 10? Why not 100?
    Try to explain a different way.

  • DECODE function to validate date value and sort the records

    Hi Friends,
    I am looking for some query which can give me the required output,
    I need to do this using SQL query only and I have tried using the MIN() and MAX() functions it was working fine with limited data, now after inserting the last record(in the below table) which has date for start_range and end_range in(mm/dd/yyyy hh24:mi:ss) format.
    Because the data type is VARCHAR2 if I am using the MIN() function it is sorting as a string value, hence the min date is incorrect. I tried using validating the value to date or non date and tried to using MIN() and MAX() functions using the DECODE function, I am getting this error "ORA-01840: input value not long enough for date format".
    select table_name,
    DECODE(substr(START_RANGE,3,1)||substr(START_RANGE,6,1)||substr(START_RANGE,11,1)||substr(START_RANGE,14,1)||substr(START_RANGE,17,1),'// ::',
    to_char(min(to_date(start_range,'mm/dd/yyyy hh24:mi:ss')),'MM/DD/YYYY HH24:MI:SS'),min(start_range)) MIN_RUNS_START_RANGE,
    DECODE(substr(END_RANGE,3,1)||substr(A.END_RANGE,6,1)||substr(END_RANGE,11,1)||substr(END_RANGE,14,1)||substr(END_RANGE,17,1),'// ::',
    to_char(max(to_date(END_RANGE,'mm/dd/yyyy hh24:mi:ss')),'MM/DD/YYYY HH24:MI:SS'),max(END_RANGE)) MAX_RUNS_END_RANGE
    from MY_TABLE
    GROUP BY table_name,
    (substr(START_RANGE,3,1)||substr(START_RANGE,6,1)||substr(START_RANGE,11,1)||substr(START_RANGE,14,1)||substr(START_RANGE,17,1)),
    (substr(END_RANGE,3,1)||substr(END_RANGE,6,1)||substr(END_RANGE,11,1)||substr(END_RANGE,14,1)||substr(END_RANGE,17,1))
    Can sombody please advise what is the best way I can query this data with the required output.
    The following are the source table and records and the out put records using the sql query.
    MY_TABLE
    TABLE_NAME(VARCHAR2),START_RANGE(VARCHAR2),END_RANGE(VARCHAR2)
    TABLE1,1000,10000
    TABLE2,ABCD,EEEE
    TABLE3,01/12/2010 00:00:00,12/31/2010 23:59:59
    TABLE1,10001,20000
    TABLE2,EEEF,GGGG
    TABLE3,01/01/2011 00:00:00,01/31/2011 23:59:59
    OUTPUT :
    TABLE_NAME,MIN(START_RANGE),MAX(END_RANGE)
    TABLE1,1000,20000
    TABLE2,ABCD,GGGG
    TABLE3,01/12/2010 00:00:00,01/31/2011 23:59:59
    Thanks
    Kalycs

    i also think this is a very bad table design ...
    but if you are not able to change it, you could split the select (date and non-date data) and combine the result with UNION like this:
    with t as
    SELECT 'TABLE1' table_name,'1000' start_range,'10000' end_range FROM dual UNION
    SELECT 'TABLE2','ABCD','EEEE' FROM dual UNION
    SELECT 'TABLE3','01/12/2010 00:00:00','12/31/2010 23:59:59' FROM dual UNION
    SELECT 'TABLE1','10001','20000' FROM dual UNION
    SELECT 'TABLE2','EEEF','GGGG' FROM dual UNION
    SELECT 'TABLE3','01/01/2011 00:00:00','01/31/2011 23:59:59' FROM dual
    SELECT table_name,
           TO_CHAR(MIN(TO_DATE(start_range, 'MM/DD/YYYY HH24:MI:SS')), 'MM/DD/YYYY HH24:MI:SS'),
           TO_CHAR(MAX(TO_DATE(end_range, 'MM/DD/YYYY HH24:MI:SS')), 'MM/DD/YYYY HH24:MI:SS')
    FROM t
    WHERE start_range LIKE '%/%/%:%:%'
    GROUP BY table_name
    UNION
    SELECT table_name,
           MIN(start_range),
           MAX(end_range)
    FROM t
    WHERE start_range NOT LIKE '%/%/%:%:%'
    GROUP BY
        table_name;
    TABLE_ MIN_VALUE           MAX_VALUE
    TABLE1 1000                20000
    TABLE2 ABCD                GGGG
    TABLE3 01/12/2010 00:00:00 01/31/2011 23:59:59

  • See my problem inquery

    sir this is my data
    whose deptid=0 that all father
    Acid          deptid          amount
    K2     0     0
    K21     0     0
    K2101     0     0
    K210101     K17     1750378
    K210102     K20     364578
    K210103     K19     817415
    K210104     K23     432684
    K2102     0     0
    K210201     K17     836750
    K210202     K20     1993475
    K210203     K19     2921924
    K2103     0     0
    K210301     K12     90960
    K210302     K9     5500
    K210303     K17     10238
    K210303     K21     580
    K210303     K23     2690
    K2104     0     0
    K210402     K25     3800
    K210403     K6     3850
    K22     0     0
    K2201     0     0
    K220101     0     0
    K22010101     K18     77390
    K22010102     K17     45000
    K22010102     K18     1300
    K220102     0     0
    K22010201     K25     55800
    K220103     0     0
    K22010301     K21     67860
    K22010302     K12     3000
    K22010302     K9     3000
    K220105     K5     73638
    K2202     0     0
    K220202     K17     43500
    K220202     K19     15000
    K220204     K5     35700
    K2203     0     0
    K220301     K15     106151
    K220301     K21     90000
    K220302     K15     11025
    K220304     K10     2600
    K220304     K12     1085
    K2204     0     0
    K220401     K12     50000
    K220401     K15     1158860
    K220401     K4     60000
    K220402     K15     123500
    K220403     K24     10250
    K220403     K4     4000
    K2205     0     0
    K220501     K15     71620
    K220501     K19     11000
    K220501     K24     3000
    K220501     K9     9453
    K220502     0     0
    K22050201     K27     12980
    K2206     0     0
    K23     0     0
    K2301     0     0
    K230101     K12     51854
    K230101     K27     1186751
    K230102     0     0
    K23010201     K12     408140
    K230103     0     0
    K23010301     K3     454310
    K23010302     K3     7500
    K230104     0     0
    K23010401     K22     333400
    K230106     0     0
    K23010601     K9     142929
    K23010602     K9     4500
    K230108     K34     -7491
    K230108     K4     651820
    K230109     0     0
    K23010902     K7     81371
    K230110     K10     148800
    K230111     0     0
    K23011101     K21     105488
    K23011101     K6     104683
    K230113     0     0
    K23011301     K8     131608
    K230114     0     0
    K23011401     K15     138625
    K2302     0     0
    K230201     K7     12236
    K230203     K12     3388
    K230203     K21     1332
    K230203     K27     1484
    K230203     K3     2713
    K230203     K4     23796
    K230203     K5     2726
    K230203     K6     2421
    K230203     K9     14490
    K230205     K4     49026
    K2303     0     0
    K230301     K27     4000
    K230301     K4     178370
    K230302     K27     5694
    K2304     0     0
    K230401     K27     2656
    K230401     K4     54817
    K230402     K4     7769
    K230403     K27     2461
    K2305     0     0
    K230503     K4     236665
    K230504     K16     7659
    K230504     K4     3526
    K2306     0     0
    K230601     K12     1450
    K230601     K13     7900
    K230601     K15     3855
    K230601     K16     830
    K230601     K17     2000
    K230601     K4     65763
    K230601     K8     25325
    K230602     K3     675
    K230602     K4     26909
    K230603     K4     251910
    K230604     K10     18050
    K230604     K12     25900
    K230604     K15     6900
    K230604     K18     7700
    K230604     K21     3800
    K230604     K24     23000
    K230604     K3     9500
    K230604     K4     27297
    K230604     K5     3850
    K230604     K6     11950
    K230604     K8     400
    K230604     K9     3300
    K2308     0     0
    K230801     K13     138500
    K230801     K4     707850
    K230802     K13     3000
    K230803     K13     3700
    K230803     K4     3880
    K2309     0     0
    K230901     K10     200
    K230901     K12     20707
    K230901     K13     200
    K230901     K15     2000
    K230901     K27     91510
    K230901     K3     8521
    K230901     K4     2075
    K230901     K5     120
    K2310     0     0
    K231001     K13     1170
    K231001     K4     22716
    K231002     K12     12742
    K231002     K16     9215
    K231002     K4     6961
    K231002     K9     1326
    K231004     K13     14335
    K231004     K15     31566
    K231004     K16     372787
    K231004     K24     2427
    K231004     K27     6414
    K231004     K34     8910
    K231004     K4     385266
    K2311     0     0
    K231101     K27     116731
    K231102     K4     223605
    K2312     0     0
    K231202     K4     60600
    K231205     K4     32000
    K2313     0     0
    K231301     K13     254334
    K231301     K3     2255
    K231301     K4     1192833
    K231301     K6     11035
    K231302     K13     6800
    K231302     K15     3500
    K231302     K8     200
    K231303     K18     3200
    K231303     K4     500
    K231303     K6     3700
    K231305     K4     14000
    K231306     K13     4200
    K231306     K4     2550
    K231307     K4     3205
    K231308     K27     65182
    K231308     K4     25075
    K231310     K13     5650
    K231310     K4     6500
    K231311     K13     117363
    K231311     K3     4395
    K231311     K4     8635
    K231312     K4     1600
    K231313     K13     80524
    K231313     K34     40444.39
    K231313     K4     375507
    K231314     K13     42300
    K231314     K4     83620
    K231315     K13     95550
    K2314     0     0
    K231401     K27     38370
    K231401     K4     39102
    K2315     K3     4000
    K2316     0     0
    K231602     K4     35000
    K2318     K12     667
    K2318     K15     10000
    K2318     K8     19508
    K2319     0     0
    K231903     K13     3220
    K231903     K23     18000
    K231903     K3     4000
    K231903     K4     55676
    K231903     K7     153250
    K231904     K13     5400
    K231904     K4     6500
    K231905     K13     53978
    K231905     K16     26200
    K231905     K4     122350
    K231906     K22     990
    K231906     K27     3990
    K231906     K4     469644
    K231906     K9     11000
    K231907     K4     2000
    K2320     0     0
    K232001     K3     1012657
    K2321     K3     2150
    K2321     K8     7824
    K2322     0     0
    K232202     K10     3000
    K232202     K13     3200
    K232202     K25     35
    K232202     K27     550
    K232202     K3     1580
    K232202     K4     35654
    K232202     K5     882
    K232206     K16     25160
    sir my need is
    all child amount sum and show in father group by deptid
    such as acid K2 is a father all those amount sum that have start 2 word is K2 group by deptid
    such as
    sir I use case but that give only sum amount or only one value not give all deptid wise sum result
    select deptid,acid,
    case when deptid=0 then
    (select sum(amount) from
    (SELECT accid,'0' AS deptid,0 AS amount FROM CHARTOFACC WHERE SUBSTR(CHARTOFACC.accid,1,2)='K2' AND fstatus=1
    UNION
    SELECT mfa.accid,mfa.deptid,mfa.amount FROM (
    SELECT VOUDETAIL.deptid,VOUDETAIL.accid,NVL(SUM(debit),0)-NVL(SUM(credit),0) AS AMOUNT
    FROM VOUMASTER,VOUDETAIL,DEPARTMENTMFA WHERE VOUMASTER.vno=VOUDETAIL.vno AND SUBSTR(VOUDETAIL.accid,1,2)='K2' AND VOUDETAIL.deptid=DEPARTMENTMFA.deptid
    AND VOUMASTER.entdate BETWEEN '01-jul-2006' AND '30-jun-2007'
    GROUP BY VOUDETAIL.deptid,VOUDETAIL.accid) mfa)
    where substr(acid,1,2)=’K2’ group by deptid)
    from (SELECT accid,'0' AS deptid,0 AS amount FROM CHARTOFACC WHERE SUBSTR(CHARTOFACC.accid,1,2)='K2' AND fstatus=1
    UNION
    SELECT mfa.accid,mfa.deptid,mfa.amount FROM (
    SELECT VOUDETAIL.deptid,VOUDETAIL.accid,NVL(SUM(debit),0)-NVL(SUM(credit),0) AS AMOUNT
    FROM VOUMASTER,VOUDETAIL,DEPARTMENTMFA WHERE VOUMASTER.vno=VOUDETAIL.vno AND SUBSTR(VOUDETAIL.accid,1,2)='K2' AND VOUDETAIL.deptid=DEPARTMENTMFA.deptid
    AND VOUMASTER.entdate BETWEEN '01-jul-2006' AND '30-jun-2007'
    GROUP BY VOUDETAIL.deptid,VOUDETAIL.accid) mfa
    Acid          deptid          amount
    K2          K1          334
    K2          K2          3111
    K2          K3          748
    K2          K4          33422
    K2          K5          33411
    K21          K1          334
    K21          K2          3111
    K21          K3          748
    K21          K4          33422
    K21          K5          33411
    K2101          K1          334
    K2101          K2          3111
    K2101          K3          748
    K2101          K4          33422
    K2101          K5          33411
    K2201          K1          334
    K2201          K2          3111
    K2201          K3          748
    K2201          K4          33422
    K2201          K5          33411
    Sir how I get child result in father group by deptid
    Can I use loop in query that run dept table and sum dept wise result
    Please give me idea bow I get resutl
    thank's

    meaby a hint I can give you is you can do a grouping by on substr. example:
    create table t(v varchar2(30), n number);
    insert into t values('K201',5);
    insert into t values ('K202', 10);
    select sum(n)
    from t
    group by substr(v,0,3); => result: 15
    But actually I think you need to rethink your data structure. Add a parent_id so you can use hierarchical queries, ...

  • Urgent please-sorting code issue in BIP

    Hi,
    issue with sort order in BIP reports. I gave code like this but saying expression error. Please help me.
    sort should be in the order of numbers , then upper case then lower case values.
    declared variable is <?variable: srtStr; "'01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'"?>
    then i am trying to apply code in my group
    <?for-each-group:ssAssetMgmtAsset;./ssReferenceNumber3?><?sort:current-group()/string-length(substring-before ($srtStr,substring(ssReferenceNumber3,1,1)));'ascending';data-type='text'?>
    the above code saying expression error
    Thanks,
    lax

    What is the exact error you get?
    I believe that the data-type (within the for-each-group) should be number. Try that and let me know if that fixes your issue.
    Thanks,
    Bipuser

  • Problem with stacked bar query

    Hello,
    I tubbing a while on this already and probably the answer is right there.
    I have table with date,product,qty column and I want a stacked bar with the sum of quantity for each product for a certain period.
    so period is the label but how can I created the sum(qty) for each item and display it in a stacked bar?
    Thanks for the help

    Hi Irvine,
    If you want to try and make a stacked bar chart, you will need to add a new serie for each product you'd like to see in your chart. I don't see any other way to make this generic for each product in your products table.
    But if you like to make a new serie for each product i'll give you a small example on how you can do this.
    First create your chart and fill in a query for your first product:
    example:
    select product,substr(p_date,4,3),sum(quantity)
    from table
    where lower(name) = 'keyboard'
    group by product,substr(p_date,4,3)
    This will give you as result: the sum of the quantity for a certain month for the product 'keyboard'. This will be your first serie.
    Now go to the chart attributes and choose 'add series', now you can add the serie for the next product, f.e.:
    select product,substr(p_date,4,3),sum(quantity)
    from table
    where lower(name) = 'mouse'
    group by product,substr(p_date,4,3)
    Do this for every product you'd like to add to your chart.
    Grtz,
    Tuur
    Message was edited by:
    HENDRTU

  • Column Not Displayed in Universe

    Hi,
    I can't see column in Universe. I'm connecting to SAP Tables using ODBC. My database is MaxDB. My platform is Windows 32-bit. I'm using BO Edge XI 3.1. Here is my original PRM file.
    <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE DBParameters SYSTEM "../dbparameters.dtd"><DBParameters>
         <Configuration>
              <Parameter Name="DB_TYPE">GENERIC</Parameter>
              <Parameter Name="SORT_BY_NO">YES</Parameter>
              <Parameter Name="GROUPBYCOL">NO</Parameter>
              <Parameter Name="EXT_JOIN">NO </Parameter>
              <Parameter Name="CONCAT">+</Parameter>
              <Parameter Name="UNION"></Parameter>
              <Parameter Name="UNION_IN_SUBQUERY"></Parameter>
              <Parameter Name="INTERSECT"></Parameter>
              <Parameter Name="INTERSECT_IN_SUBQUERY"></Parameter>
              <Parameter Name="MINUS"></Parameter>
              <Parameter Name="MINUS_IN_SUBQUERY"></Parameter>
              <Parameter Name="OWNER">Y</Parameter>
              <Parameter Name="QUALIFIER">Y</Parameter>
              <Parameter Name="COMMA">' '</Parameter>
              <Parameter Name="NO_DISTINCT">Y</Parameter>
              <Parameter Name="REFRESH_COLUMNS_TYPE">T</Parameter>
              <Parameter Name="CHECK_OWNER_STATE">Y</Parameter>
              <Parameter Name="CHECK_QUALIFIER_STATE">Y</Parameter>
              <Parameter Name="KEY_INFO_SUPPORTED">N</Parameter>
              <Parameter Name="OUTERJOINS_GENERATION">NO</Parameter>
              <Parameter Name="EVAL_WITHOUT_PARENTHESIS">N</Parameter>
              <Parameter Name="USER_INPUT_DATE_FORMAT">{\d 'yyyy-mm-dd'}</Parameter>
            <Parameter Language="ja" Name="USER_INPUT_DATE_FORMAT">{!d 'yyyy-mm-dd'}</Parameter>
              <Parameter Name="USER_INPUT_NUMERIC_SEPARATOR">.</Parameter>
         </Configuration>
         <DateOperations>
              <DateOperation Name="YEAR">{fn year($D)}</DateOperation>
              <DateOperation Name="MONTH">{fn month($D)}</DateOperation>
         </DateOperations>
         <Operators>
              <Operator Arity="1" ID="ADD" Type="Numeric">+</Operator>
              <Operator Arity="1" ID="SUBSTRACT" Type="Numeric">-</Operator>
              <Operator Arity="1" ID="MULTIPLY" Type="Numeric">*</Operator>
              <Operator Arity="1" ID="DIVIDE" Type="Numeric">/</Operator>
              <Operator Arity="0" ID="NOT_NULL" Type="Logical">IS NOT NULL</Operator>
              <Operator Arity="0" ID="NULL" Type="Logical">IS NULL</Operator>
              <Operator Arity="1" ID="SUP" Type="Logical">&gt;=</Operator>
              <Operator Arity="1" ID="INF" Type="Logical">&lt;=</Operator>
              <Operator Arity="1" ID="EQUAL" Type="Logical">=</Operator>
              <Operator Arity="1" ID="DIFF" Type="Logical">&lt;&gt;</Operator>
              <Operator Arity="1" ID="STRICT_SUP" Type="Logical">&gt;</Operator>
              <Operator Arity="1" ID="STRICT_INF" Type="Logical">&lt;</Operator>
              <Operator Arity="1" ID="IN_LIST" Type="Logical">IN</Operator>
              <Operator Arity="1" ID="NOT_IN_LIST" Type="Logical">NOT IN</Operator>
              <Operator Arity="1" ID="MATCH" Type="Logical">LIKE</Operator>
              <Operator Arity="1" ID="NOT_MATCH" Type="Logical">NOT LIKE</Operator>
              <Operator Arity="2" ID="BETWEEN" Type="Logical">BETWEEN  AND</Operator>
              <Operator Arity="2" ID="NOT_BETWEEN" Type="Logical">NOT BETWEEN  AND</Operator>
         </Operators>
         <Functions>
              <Function Distinct="False" Group="True" ID="Minimum" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>min($1)</SQL>
              </Function>
              <Function Distinct="False" Group="True" ID="Maximum" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>max($1)</SQL>
              </Function>
              <Function Distinct="False" Group="True" ID="Average" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>avg($1)</SQL>
              </Function>
              <Function Distinct="False" Group="True" ID="Sum" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>sum($1)</SQL>
              </Function>
              <Function Distinct="False" Group="True" ID="Count" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="All"></Argument>
                   </Arguments>
                   <SQL>count($1)</SQL>
              </Function>
              <Function Group="False" ID="ASCII_code" InMacro="False" Type="String">
                   <Arguments>
                        <Argument Type="Char"></Argument>
                   </Arguments>
                   <SQL>{fn ascii($1)}</SQL>
              </Function>
              <Function Group="False" ID="Character" InMacro="False" Type="String">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn char($1)}</SQL>
              </Function>
              <Function Group="False" ID="Concat" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn concat($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Left" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn left($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="LeftRemove" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn ltrim($1)}</SQL>
              </Function>
              <Function Group="False" ID="Length" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn length($1)}</SQL>
              </Function>
              <Function Group="False" ID="Locate" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn locate($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Lowercase" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn lcase($1)}</SQL>
              </Function>
              <Function Group="False" ID="Repeat" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn repeat($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Rightpart" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn right($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Rtrim" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn rtrim($1)}</SQL>
              </Function>
              <Function Group="False" ID="Substring" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                        <Argument Type="Numeric"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn substring($1,$2,$3)}</SQL>
              </Function>
              <Function Group="False" ID="Uppercase" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>{fn ucase($1)}</SQL>
              </Function>
              <Function Group="False" ID="Absolute" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn abs($1)}</SQL>
              </Function>
              <Function Group="False" ID="Arc_cosine" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn acos($1)}</SQL>
              </Function>
              <Function Group="False" ID="Arc_sine" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn asin($1)}</SQL>
              </Function>
              <Function Group="False" ID="Arc_tangent" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn atan($1)}</SQL>
              </Function>
              <Function Group="False" ID="Angle_Tangent_2" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn atan2($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Cosine" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn cos($1)}</SQL>
              </Function>
              <Function Group="False" ID="Ceil" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn ceiling($1)}</SQL>
              </Function>
              <Function Group="False" ID="Exp" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn exp($1)}</SQL>
              </Function>
              <Function Group="False" ID="Floor" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn floor($1)}</SQL>
              </Function>
              <Function Group="False" ID="Log" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn log($1)}</SQL>
              </Function>
              <Function Group="False" ID="Mod" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn mod($1,$2)}</SQL>
              </Function>
              <Function Group="False" ID="Pi" InMacro="False" Type="Numeric">
                   <SQL>{fn pi()}</SQL>
              </Function>
              <Function Group="False" ID="Random" InMacro="False" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn rand($1)}</SQL>
              </Function>
              <Function Group="False" ID="Sign" InMacro="False" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn sign($1)}</SQL>
              </Function>
              <Function Group="False" ID="Sine" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn sin($1)}</SQL>
              </Function>
              <Function Group="False" ID="Sqrt" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn sqrt($1)}</SQL>
              </Function>
              <Function Group="False" ID="Tangent" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="Numeric"></Argument>
                   </Arguments>
                   <SQL>{fn tan($1)}</SQL>
              </Function>
              <Function Group="False" ID="Character_prompt" InMacro="True" Type="String">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>@prompt($1,'A',,,)</SQL>
              </Function>
              <Function Group="False" ID="Numeric_prompt" InMacro="True" Type="Numeric">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>@prompt($1,'N',,,)</SQL>
              </Function>
              <Function Group="False" ID="Date_prompt" InMacro="True" Type="DateTime">
                   <Arguments>
                        <Argument Type="String"></Argument>
                   </Arguments>
                   <SQL>@prompt($1,'D',,,)</SQL>
              </Function>
         </Functions>
    </DBParameters>
    Assistance is much appreciated. Thank you.
    Rgds,
    Hapizorr

    Hi
    this is a rather unconventional and not officially supported way to access SAP data. Some of the table fields as you see them in SAP R3 do not have corresponding fields in the underlying database.
    If you want to build reports on SAP R3 table you have the following options:
    1) Use the SAP rapid marts and extract your R3 data into a DWH based on a relational database. You also get a universe on which you can build your reports.
    2) You can use Crystal Reports and the native R3 table driver
    3) There is also a prototype (This is NOT a product) R3 connector for the Data FEderator that will allo you to build relational universes on SAP R3 sources.
    4) Load your data into a BW system and build OLAP universes on top of BEx queries.
    Regards,
    Stratos

  • Please Help....Need base tables link from Trade management to General Ledge

    HI,
    As per our current requirement we need to pull data from Trademanagement Module to General Ledger.
    we are able get exact data which is posted in GL.
    since we need to display only finished Items in product column. we are getting some unfinished Products also.
    is there any table which has correct link trademanagement to GL. Version R12:
    we have used the below query:
    ------------------------------------Start TM-GL Item Level-------------------------------------------
    SELECT 'FY'||substr(batch_period_name,5,2) Year
    , substr(batch_period_name,0,3) Period
    , 'Final' version
    , 'Actual' Scenario
    , ('C'||substr(account,0,3)) Company
    , ('A'||substr(account,5,5)) GL_Account
    , substr(account,11,2) BU
    , ('PC'||substr(account,14,3)) Profit_Center
    , Plan_Dist
    , decode(Product,'','No_Product',Product) Product
    , Site_No
    , currency_code
    , substr(account,18,2) Country
    , sum(nvl(accounted_dr,0)-nvl(accounted_cr,0)) Amount
    , batch_period_name
    FROM (SELECT
    gjh.currency_code
    , gjh.je_category
    , gjh.je_source
    , gjh.period_name je_period_name
    , gjh.name journal_name
    , gjb.name batch_name
    , gjh.status journal_status
    , gjh.creation_date je_created_date
    , gjL.period_name batch_period_name
    , gjl.je_line_num line_number
    , gjl.ledger_id
    , gjl.entered_dr
    , gjl.entered_cr
    , gjl.accounted_dr
    , gjl.accounted_cr
    , gjl.description
    , gjh.running_total_accounted_dr je_total_dr
    , gjh.running_total_accounted_cr je_total_cr
    , gcc.concatenated_segments Account
    , xdl.source_distribution_type
    , xdl.source_distribution_id_num_1
    , xlate.source_id_int_1
    , (select distinct segment1
    from mtl_system_items_b@ebs_link
    where inventory_item_id= ofuab.product_id ) Product
    , (select distinct HCSusesal.attribute4
    from HZ_CUST_ACCT_SITES_ALL@ebs_link hcasiteall
    ,HZ_CUST_SITE_USES_ALL@ebs_link HCSusesal
    ,HZ_CUST_ACCOUNTS@ebs_link hca
    where HCSusesal.cust_acct_site_id= hcasiteall.cust_acct_site_id
    AND ofuab.ship_to_site_use_id=HCSusesal.site_use_id
    AND hcasiteall.cust_account_id=hca.cust_account_id) Site_No
    ,(select distinct hpsites.party_site_number
    from HZ_PARTIES@ebs_link hpart
    ,HZ_LOCATIONS@ebs_link hloc
    ,HZ_CUST_ACCOUNTS@ebs_link z
    ,HZ_PARTY_SITES@ebs_link hpsites
    ,HZ_CUST_ACCT_SITES_ALL@ebs_link hcasiteall
    ,HZ_CUST_SITE_USES_ALL@ebs_link HCSusesal
    ,HZ_CUST_ACCOUNTS@ebs_link hca
    -- ,HZ_CUST_SITE_USES_ALL_MNC mnc
    where hpsites.location_id= hloc.location_id
    and hpart.party_id= hpsites.party_id
    and hpsites.party_site_id= hcasiteall.party_site_id
    and HCSusesal.cust_acct_site_id= hcasiteall.cust_acct_site_id
    and hpart.party_id= hca.party_id
    -- and mnc.cust_acct_site_id= hcasiteall.cust_acct_site_id
    and z.party_id= hpart.party_id
    and ofuab.ship_to_site_use_id=HCSusesal.site_use_id) Plan_Dist
    FROM gl_je_headers@ebs_link gjh,
    gl_je_lines@ebs_link gjl,
    gl_import_references@ebs_link gir,
    gl_code_combinations_kfv@ebs_link gcc,
    gl_je_batches@ebs_link gjb,
    xla_ae_lines@ebs_link xal,
    xla_ae_headers@ebs_link xah,
    xla_events@ebs_link xe,
    xla_event_types_tl@ebs_link xet,
    xla_event_classes_tl@ebs_link xect,
    xla_distribution_links@ebs_link xdl,
    xla.xla_transaction_entities@ebs_link xlate,
    ozf_funds_utilized_all_b@ebs_link ofuab
    WHERE gjh.je_header_id = gjl.je_header_id
    --AND gjh.reversed_je_header_id = gjl.je_header_id
    --AND gjh.je_header_id = gir.je_header_id
    AND (gjh.reversed_je_header_id = gir.je_header_id OR gjh.je_header_id = gir.je_header_id)
    --AND gjl.je_header_id = gir.je_header_id
    AND gir.je_line_num = gjl.je_line_num
    AND gcc.code_combination_id = gjl.code_combination_id
    AND gjb.je_batch_id = gjh.je_batch_id
    AND gir.gl_sl_link_id = xal.gl_sl_link_id
    AND xal.ae_header_id = xah.ae_header_id
    AND xah.event_id = xe.event_id
    AND xe.event_type_code = xet.event_type_code
    AND xe.application_id = xet.application_id
    AND xet.LANGUAGE = USERENV ('LANG')
    AND xect.event_class_code = xet.event_class_code
    AND xect.application_id = xe.application_id
    AND xect.LANGUAGE = USERENV ('LANG')
    AND xah.ae_header_id = xdl.ae_header_id
    AND xal.ae_line_num = xdl.ae_line_num
    AND xe.entity_id = xlate.entity_id
    AND xe.application_id = xlate.application_id
    AND xlate.source_id_int_1=ofuab.utilization_id
    AND gjh.je_source = 'Marketing'
    AND gjl.status='P'
    AND gcc.segment3 in ('10')
    AND gcc.segment1 <> 'C01'
    AND substr(gcc.concatenated_segments,5,1) in (4,5)
    AND gcc.segment6 not like ('SPO%')
    AND ofuab.utilization_type <> 'ADJUSTMENT'
    -- AND gcc.concatenated_segments = '101.41220.10.999.US.BAZ2503.000.0000'
    -- AND gjl.je_line_num in( 5674,5675,5676,5677)
    -- AND gjl.period_name = 'AUG-12'
    -- AND gjh.je_header_id IN (7236,7235)
    -- AND gjl.je_line_num = 3830
    AND substr(gcc.concatenated_segments,5,2) not in('40'))
    AND gjl.je_line_num in( 5674,5675,5676,5677)) PG -- 11/23/12
    GROUP BY 'FY'||substr(batch_period_name,5,2)
    , substr(batch_period_name,0,3)
    , 'Actual'
    , substr(account,0,3)
    , substr(account,5,5)
    , substr(account,11,2)
    , substr(account,14,3)
    , substr(account,21,7)
    , currency_code
    , Product
    , substr(account,18,2)
    , Site_No
    , Plan_dist
    , batch_period_name
    , 'Final'
    ------------------------------------End TM-GL Item Level-------------------------------------------
    Please help me if any body worked on this issue.
    Thanks,
    Ram

    I have find the answer for my Question...
    We can have 2 columns in ozf_funds_utilized_all_b. product_type and Product_id.
    If product_type is Family then Product_id would be the Item Category ID.
    If Product_type is Product then Product_id would be the Inventory_item_id.
    Thanks,
    Ram

  • Error Message "PLS:707, unsupported construct or internal error "

    I am having a Stored Procedure which runs most of the times successfully when executed.But all of a sudden it throws a error message
    ERROR at line 1:
    ORA-06553: PLS-707: unsupported construct or internal error [2601]
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    So to correct this problem, i just compile the procedure again without doing any change.After doing this it works fine.When i logout from Oracle and relogin and try to execute the same SP , it again throws the error message.I am in need of a solution for this problem at the earliest.So request you to provide the feedback at the earliest.
    I am using
    Oracle8 Release 8.0.5.0.0
    PL/SQL Release 8.0.5.0.0
    I have attached the source code below.
    CREATE OR REPLACE PROCEDURE Gen_SinPrjEff(Sp_Proj_Id IN NUMBER,
    Sp_Emp_Id IN VARCHAR2,
    Sp_Start_Date IN VARCHAR2,
    SP_End_Date IN VARCHAR2)
    IS
    Date_Null NUMBER(1) := 0;
    CURSOR prjeff IS
    SELECT aa,
    bb,
    dd,
    sum(ee)
    FROM ( SELECT 'ProjectEffort' aa,
    RPAD(SUBSTR(b.employeename,1,20),20,' ') bb,
    '' dd,
    SUM(a.hourstoday) ee
    FROM timesheetentry a,
    employeemst b,
    project c,
    project d
    WHERE a.entryfromprojectid = Sp_Proj_Id
    AND a.projectid = Sp_Proj_Id
    AND c.projectid = a.entryfromprojectid
    AND d.projectid = a.projectid
    AND b.employeeno = a.employeeno
    AND ((Date_Null = 9) OR ((Date_Null = 1) AND
    (a.entrydate BETWEEN TO_DATE(Sp_Start_Date,'DD-Mon-YYYY') AND
    TO_DATE(Sp_End_Date,'DD-Mon-YYYY'))))
    GROUP BY RPAD(SUBSTR(b.employeename,1,20),20,' '),
    SUBSTR(d.projname,1,30)
    UNION
    SELECT 'ProjectEffort' aa,
    RPAD(SUBSTR(b.employeename,1,20),20,' ') bb,
    '' dd,
    SUM(a.hourstoday) "ee"
    FROM timesheetentry a,
    employeemst b,
    project c,
    project d
    WHERE a.entryfromprojectid <> Sp_Proj_Id
    AND a.projectid = Sp_Proj_Id
    AND c.projectid = a.entryfromprojectid
    AND d.projectid = a.projectid
    AND b.employeeno = a.employeeno
    AND ((Date_Null = 9) OR ((Date_Null = 1) AND
    (a.entrydate BETWEEN TO_DATE(Sp_Start_Date,'DD-Mon-YYYY') AND
    TO_DATE(Sp_End_Date,'DD-Mon-YYYY'))))
    GROUP BY RPAD(SUBSTR(b.employeename,1,20),20,' '),
    SUBSTR(d.projname,1,30)
    GROUP BY aa,bb,dd
    UNION
    SELECT 'ProjectOthers',
    RPAD(SUBSTR(b.employeename,1,20),20,' ') "Employee Name",
    RPAD(SUBSTR(d.projname,1,30),30,' ') dd,
    SUM(a.hourstoday) "Effort Spent"
    FROM timesheetentry a,
    employeemst b,
    project c,
    project d
    WHERE a.entryfromprojectid = Sp_Proj_Id
    AND a.projectid <> Sp_Proj_Id
    AND c.projectid = a.entryfromprojectid
    AND d.projectid = a.projectid
    AND d.swonflag = 0
    AND b.employeeno = a.employeeno
    AND ((Date_Null = 9) OR ((Date_Null = 1) AND
    (a.entrydate BETWEEN TO_DATE(Sp_Start_Date,'DD-Mon-YYYY') AND
    TO_DATE(Sp_End_Date,'DD-Mon-YYYY'))))
    GROUP BY RPAD(SUBSTR(b.employeename,1,20),20,' '),
    SUBSTR(d.projname,1,30)
    UNION
    SELECT 'SwonEffort',
    RPAD(SUBSTR(b.employeename,1,20),20,' ') "Employee Name",
    RPAD(SUBSTR(d.projname,1,30),30,' ') "Project To",
    SUM(a.hourstoday) "Effort Spent"
    FROM timesheetentry a,
    employeemst b,
    project c,
    project d
    WHERE a.entryfromprojectid = Sp_Proj_Id
    AND a.projectid <> Sp_Proj_Id
    AND c.projectid = a.entryfromprojectid
    AND d.projectid = a.projectid
    AND d.swonflag = 1
    AND b.employeeno = a.employeeno
    AND ((Date_Null = 9) OR ((Date_Null = 1) AND
    (a.entrydate BETWEEN TO_DATE(Sp_Start_Date,'DD-Mon-YYYY') AND
    TO_DATE(Sp_End_Date,'DD-Mon-YYYY'))))
    GROUP BY RPAD(SUBSTR(b.employeename,1,20),20,' '),
    SUBSTR(d.projname,1,30);
    Eff_Type admin32.prjeffdata.prjefftype%type;
    Proj_Name admin32.prjeffdata.projname%type;
    Emp_Name admin32.prjeffdata.empname%type;
    Proj_Eff admin32.prjeffdata.projeff%type;
    Tmp_Dind admin32.prjeffdata.del_ind%type;
    BEGIN
    -- dbms_output.put_line('Begin');
    Tmp_Dind := NULL;
    TmP_Dind := LPAD(LTRIM(RTRIM(Sp_Emp_Id)),6,'0') || LPAD(LTRIM(RTRIM(TO_CHAR(Sp_Proj_Id))),5,'0');
    IF (Sp_Start_Date IS NULL) THEN
    Date_Null := 9;
    ELSE
    Date_Null := 1;
    END IF;
    dbms_output.put_line(to_char(date_null));
    DELETE prjeffdata
    WHERE del_ind = LPAD(LTRIM(RTRIM(Sp_Emp_Id)),6,'0') || LPAD(LTRIM(RTRIM(TO_CHAR(Sp_Proj_Id))),5,'0');
    COMMIT;
    OPEN prjeff;
    LOOP
    Eff_Type := NULL;
    Proj_Name := NULL;
    Emp_Name := NULL;
    Proj_Eff := NULL;
    FETCH prjeff
    INTO Eff_Type,
    Emp_Name,
    proj_Name,
    proj_Eff;
    EXIT WHEN prjeff%NOTFOUND;
    INSERT INTO prjeffdata(prjefftype,
    empname,
    projname,
    projeff,
    del_ind)
    VALUES (eff_type,
    emp_name,
    proj_name,
    proj_eff,
    Tmp_Dind);
    --dbms_output.put_line(eff_type || ',' || emp_name || ',' || proj_name );
    END LOOP;
    CLOSE prjeff;
    COMMIT;
    --dbms_output.put_line('End');
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    dbms_output.put_line('Error');
    WHEN OTHERS THEN
    dbms_output.put_line('Error');
    END

    This is what works on 8.1.7. I don't know the svrmgrl name in 8.0.5, but it should be in your %ORACLE_HOME%/bin
    > cd %oracle_home%\rdbms\admin
    >svrmgr sys/<password>@dbname
    SVRMGR> @standard
    Statement processed.
    Statement processed.
    Statement processed.
    SVRMGR> @UTLRP
    if this doesn't work then do this
    SVRMGR> @catalog
    good luck

  • Simple webcrawler

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.ArrayList;
    import java.util.Vector;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class WebCrawler implements Runnable{
          // URLs to be searched
        Vector<String> vectorToSearch = new Vector<String>();
        // URLs already searched
        Vector<String> vectorSearched = new Vector<String>();
        // URLs which match
        Vector<String> vectorMatches = new Vector<String>();
        String address = "http://www.bloomberg.com";
         public static void main(String[] args){
              WebCrawler webCrawler = new WebCrawler();
              webCrawler.start();
         public void start() {
              vectorToSearch.add(address);
              run();
         public void run() {
              try{
                   while (vectorToSearch.size() > 0){
                        System.out.println("Searching "+vectorToSearch.get(0));
                        getAndParsePage(vectorToSearch.get(0));
              catch(Exception e){
                   e.printStackTrace();
         private void getAndParsePage(String add) throws IOException{
              try{
                   URL url = new URL(add);
                   BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                   String i;
                   Vector<String> thisUrl = null;
                   thisUrl = new Vector<String>();
                   while (((i=in.readLine()) != null)){thisUrl.add(i);}
                   for (String input : thisUrl){
                        if (input.indexOf("href=\"http://")!=-1){
                             Pattern pattern = Pattern.compile("http://.*\"");
                             Matcher matcher = pattern.matcher(input);
                             if (matcher.find()){
                                  String result = matcher.group();
                                  result = result.substring(0,result.indexOf("\""));
                                  try {
                                       URL urlLink = new URL(result);
                                       result = urlLink.toString();
                                       if (!result.equals(add))
                                            if(!wasSearched(add))
                                                 vectorToSearch.add(0,result);
                                   catch (MalformedURLException e) {
              }catch(Exception e){
              vectorToSearch.remove(add);
              vectorSearched.add(add);
              System.out.println("closing "+add);
         private boolean wasSearched(String add){
              for (String s : vectorSearched) if (s.equals(add))return true;
              return false;
    }the problem is i search some urls more then once
    Message was edited by:
    Kernel_77

    kernel,
    Pattern.compile("http://.*\"");
    the .* is greedy, meaning that it'll keep matching to the end of the line... sugest you try [^\"]*\" in place of .*
    can't see why it would search some URL's twice though... unless they're in the source page twice.
    keith/
    Message was edited by: corlettk

  • Oracle User/Schema Role?

    For a long long times before, I created a schema named "kennam" (kennam/kennam007@kennam), but it having system tables like "SMP_VDM_ADDRESS" on Oracle SQL Developer.
    I don't want to see system table(s). What should I do?
    Also, why I created a new user/schema "koonhey", recently (koonhey/koonhey007@koonhey) is NO system table .

    Did you (or somebody else) by any chance run 9.x EM Config Assistant, EM Trace Data Viewer or other tools from EM packs while loggeed in as that database user?
    Run this query:
    select owner,substr(object_name,1,4) tabgroup, count(*) numof_couldbe_emrepobjs from dba_objects
    where object_name like 'SMP\_%' escape '\' or object_name like 'EPC\_%' escape '\'
    or object_name like 'EVT\_%' escape '\' or object_name like 'VD_\_%' escape '\'
    group by owner, substr(object_name,1,4);
    I suspect that abbreviations such as these could belong to OEM (OMS repository):
    EPC = EM Trace Data Viewer (Event Performance Collector)
    EVT = EM Events
    SMP = EM general repository
    VD? = EM framework
    You could check your listener.log to find programs that have connected to your database.
    Message was edited by:
    orafad

  • Very slow distinct

    Guys,
    Please any of you experts, help me re-write the query.. I see the physical IO seems to be extreamly slow with this query.. I think it may be due to the joins. Is there a better way to re-write this ? I think SORT_UNIQUE is holding up the performance of this query.
    SELECT DISTINCT ld.lock_id, ev.entity_id, ev.entity_volume_id,
    -- to get new evid
    ev.last_updated_by, ev.last_updated_date_time, ev.created_by,
    ev.created_date_time
    FROM entity_volume ev,
    entity_volume_lock evl,
    lock_detail ld,
    period p
    WHERE ev.program_id = :b5
    AND ld.program_id = :b4
    AND ev.volume_type = :b3
    AND ld.period_id = ev.period_id
    AND evl.entity_id = ev.entity_id
    AND evl.lock_id = ld.lock_id
    AND ld.period_id = p.period_id
    AND p.month_year BETWEEN :b2 AND :b1
    Explain plan is as below
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=ALL_ROWS          7           1993                     
    SORT UNIQUE          7      679      1993                     
    FILTER                                        
    TABLE ACCESS BY LOCAL INDEX ROWID     ENTITY_VOLUME     1      61      3                     
    NESTED LOOPS          7      679      1970                     
    NESTED LOOPS          553      19 K     311                     
    NESTED LOOPS          135      3 K     41                     
    TABLE ACCESS FULL     PERIOD     1      11      2                     
    INDEX RANGE SCAN     LOCK_DETAIL_IDX002     1      15      39                     
    INDEX RANGE SCAN     ENTITY_VOLUME_LOCK_IDX_002     41      410      2                     
    PARTITION RANGE SINGLE                                   KEY     KEY
    INDEX RANGE SCAN     ENTITY_VOLUME_IDX_001     1           2                KEY     KEY

    I'm not certain why Mr. Beilstein never replied and I believe his claim that "a programmer can almost always bypass the need to do a distinct" may be a little optomistic.
    However, consider the two queries below:
    SELECT CBONAME CBONAME
    FROM (
    SELECT 1 ORDNUM, 'MAN_'||TO_CHAR(SYSDATE,'YYYYMMDD')||UPPER('_'||:STRUSER) CBONAME FROM DUAL
    UNION ALL
    SELECT DISTINCT 2 ORDNUM, BATCHNAME CBONAME FROM LND_STAGESALESTRANSACTION
    WHERE UPPER(BATCHNAME) LIKE UPPER('%_'||:STRUSER) OR :ISADMIN = 1
    AND SUBSTR(UPPER(BATCHNAME),1,4)='MAN_'
    AND (STAGEPROCESSFLAG = 0 OR STAGEPROCESSFLAG = :SHOWPROCESSED)
    ORDER BY ORDNUM
    SELECT CBONAME CBONAME, SUBSTR(CBONAME,LENGTH(:STRUSER)*-1)
    FROM (
    SELECT 1 ORDNUM, 'MAN_'||TO_CHAR(SYSDATE,'YYYYMMDD')||UPPER('_'||:STRUSER) CBONAME FROM DUAL
    UNION ALL
    SELECT 2 ORDNUM, BATCHNAME CBONAME FROM LND_STAGESALESTRANSACTION
    WHERE SUBSTR(UPPER(BATCHNAME),1,4)='MAN_'
    AND UPPER(SUBSTR(BATCHNAME,LENGTH(:STRUSER)*-1)) = UPPER(:STRUSER) OR :ISADMIN = 1
    AND (STAGEPROCESSFLAG = 0 OR STAGEPROCESSFLAG = :SHOWPROCESSED)
    GROUP BY BATCHNAME
    The first is an example using distinct and like clauses. The second uses group by and substr. The second is twice as fast as the first.

  • Redo logfiles duplicated in RAC environment

    Hi all,
    Do you know the reason of this behavior in Oracle Rac? I have 02 logfiles for thread1 and the same 02 logfiles to thread2.
    It was supposed to be like is:
    INST_ID GROUP# STATUS MEMBER BYTES ARCHIVED
    1 2 INACTIVE +ORADATA/pgb083/onlinelog/log2a.rdo                   52428800 YES
    1 2 INACTIVE +ORADATA/pgb083/onlinelog/log2b.rdo                   52428800 YES
    2 2 INACTIVE +ORADATA/pgb083/onlinelog/log2a.rdo                   52428800 YES
    2 2 INACTIVE +ORADATA/pgb083/onlinelog/log2b.rdo                   52428800 YES
    But that is how I can see. Check it out:
    SQL> select t1.inst_id
    2 , t1.group#
    3 , t1.status
    4 , t2.member
    5 , bytes
    , t1.archived
    6 7 from gv$log t1
    8 , gv$logfile t2
    9 where t1.group# = t2.group#
    order by t1.group#,t1.inst_id,t2.member;
    10
    INST_ID GROUP# STATUS MEMBER BYTES ARCHIVED
    1 2 INACTIVE +ORADATA/pgb083/onlinelog/log2a.rdo                   52428800 YES
    1 2 INACTIVE +ORADATA/pgb083/onlinelog/log2a.rdo                   52428800 YES
    1 2 INACTIVE +ORADATA/pgb083/onlinelog/log2b.rdo                   52428800 YES
    1 2 INACTIVE +ORADATA/pgb083/onlinelog/log2b.rdo                   52428800 YES
    2 2 INACTIVE +ORADATA/pgb083/onlinelog/log2a.rdo                   52428800 YES
    2 2 INACTIVE +ORADATA/pgb083/onlinelog/log2a.rdo                   52428800 YES
    2 2 INACTIVE +ORADATA/pgb083/onlinelog/log2b.rdo                   52428800 YES
    2 2 INACTIVE +ORADATA/pgb083/onlinelog/log2b.rdo                   52428800 YES
    1 3 INACTIVE +ORADATA/pgb083/onlinelog/log3a.rdo                   52428800 YES
    1 3 INACTIVE +ORADATA/pgb083/onlinelog/log3a.rdo                   52428800 YES
    1 3 INACTIVE +ORADATA/pgb083/onlinelog/log3b.rdo                   52428800 YES
    1 3 INACTIVE +ORADATA/pgb083/onlinelog/log3b.rdo                   52428800 YES
    2 3 INACTIVE +ORADATA/pgb083/onlinelog/log3a.rdo                   52428800 YES
    2 3 INACTIVE +ORADATA/pgb083/onlinelog/log3a.rdo                   52428800 YES
    2 3 INACTIVE +ORADATA/pgb083/onlinelog/log3b.rdo                   52428800 YES
    2 3 INACTIVE +ORADATA/pgb083/onlinelog/log3b.rdo                   52428800 YES
    1 4 CURRENT +ORADATA/pgb083/onlinelog/log4a.rdo                   52428800 NO
    1 4 CURRENT +ORADATA/pgb083/onlinelog/log4a.rdo                   52428800 NO
    1 4 CURRENT +ORADATA/pgb083/onlinelog/log4b.rdo                   52428800 NO
    1 4 CURRENT +ORADATA/pgb083/onlinelog/log4b.rdo                   52428800 NO
    2 4 CURRENT +ORADATA/pgb083/onlinelog/log4a.rdo                   52428800 NO
    2 4 CURRENT +ORADATA/pgb083/onlinelog/log4a.rdo                   52428800 NO
    2 4 CURRENT +ORADATA/pgb083/onlinelog/log4b.rdo                   52428800 NO
    2 4 CURRENT +ORADATA/pgb083/onlinelog/log4b.rdo                   52428800 NO
    1 5 INACTIVE +ORADATA/pgb083/onlinelog/log5a.rdo                   52428800 YES
    1 5 INACTIVE +ORADATA/pgb083/onlinelog/log5a.rdo                   52428800 YES
    1 5 INACTIVE +ORADATA/pgb083/onlinelog/log5b.rdo                   52428800 YES
    1 5 INACTIVE +ORADATA/pgb083/onlinelog/log5b.rdo                   52428800 YES
    2 5 INACTIVE +ORADATA/pgb083/onlinelog/log5a.rdo                   52428800 YES
    2 5 INACTIVE +ORADATA/pgb083/onlinelog/log5a.rdo                   52428800 YES
    2 5 INACTIVE +ORADATA/pgb083/onlinelog/log5b.rdo                   52428800 YES
    2 5 INACTIVE +ORADATA/pgb083/onlinelog/log5b.rdo                   52428800 YES
    1 9 CURRENT +ORADATA/pgb083/onlinelog/log9a.rdo                   52428800 NO
    1 9 CURRENT +ORADATA/pgb083/onlinelog/log9a.rdo                   52428800 NO
    1 9 CURRENT +ORADATA/pgb083/onlinelog/log9b.rdo                   52428800 NO
    1 9 CURRENT +ORADATA/pgb083/onlinelog/log9b.rdo                   52428800 NO
    2 9 CURRENT +ORADATA/pgb083/onlinelog/log9a.rdo                   52428800 NO
    2 9 CURRENT +ORADATA/pgb083/onlinelog/log9a.rdo                   52428800 NO
    2 9 CURRENT +ORADATA/pgb083/onlinelog/log9b.rdo                   52428800 NO
    2 9 CURRENT +ORADATA/pgb083/onlinelog/log9b.rdo                   52428800 NO
    1 10 INACTIVE +ORADATA/pgb083/onlinelog/log10a.rdo                  52428800 YES
    1 10 INACTIVE +ORADATA/pgb083/onlinelog/log10a.rdo                  52428800 YES
    1 10 INACTIVE +ORADATA/pgb083/onlinelog/log10b.rdo                  52428800 YES
    1 10 INACTIVE +ORADATA/pgb083/onlinelog/log10b.rdo                  52428800 YES
    2 10 INACTIVE +ORADATA/pgb083/onlinelog/log10a.rdo                  52428800 YES
    2 10 INACTIVE +ORADATA/pgb083/onlinelog/log10a.rdo                  52428800 YES
    2 10 INACTIVE +ORADATA/pgb083/onlinelog/log10b.rdo                  52428800 YES
    2 10 INACTIVE +ORADATA/pgb083/onlinelog/log10b.rdo                  52428800 YES
    48 rows selected.
    Any idea?

    SQL> select lg.inst_id,lg.group#,lg.thread#,SUBSTR(lf.member,1,50) from gv$log lg,gv$logfile lf where lg.inst_id=lf.inst_id and lg.group#=lf.group#
    2 order by inst_id,group#,thread#
    3 ;
    INST_ID GROUP# THREAD# SUBSTR(LF.MEMBER,1,50)
    1 1 2 +ORADATA/pgb082/onlinelog/log1b.rdo
    1 1 2 +ORADATA/pgb082/onlinelog/log1a.rdo
    1 2 1 +ORADATA/pgb082/onlinelog/log3b.rdo
    1 2 1 +ORADATA/pgb082/onlinelog/log3a.rdo
    1 3 1 +ORADATA/pgb082/onlinelog/log5b.rdo
    1 3 1 +ORADATA/pgb082/onlinelog/log5a.rdo
    1 4 2 +ORADATA/pgb082/onlinelog/log6b.rdo
    1 4 2 +ORADATA/pgb082/onlinelog/log6a.rdo
    1 5 2 +ORADATA/pgb082/onlinelog/log7a.rdo
    1 5 2 +ORADATA/pgb082/onlinelog/log7b.rdo
    1 6 1 +ORADATA/pgb082/onlinelog/log8b.rdo
    1 6 1 +ORADATA/pgb082/onlinelog/log8a.rdo
    2 1 2 +ORADATA/pgb082/onlinelog/log1b.rdo
    2 1 2 +ORADATA/pgb082/onlinelog/log1a.rdo
    2 2 1 +ORADATA/pgb082/onlinelog/log3a.rdo
    2 2 1 +ORADATA/pgb082/onlinelog/log3b.rdo
    2 3 1 +ORADATA/pgb082/onlinelog/log5a.rdo
    2 3 1 +ORADATA/pgb082/onlinelog/log5b.rdo
    2 4 2 +ORADATA/pgb082/onlinelog/log6a.rdo
    2 4 2 +ORADATA/pgb082/onlinelog/log6b.rdo
    2 5 2 +ORADATA/pgb082/onlinelog/log7b.rdo
    2 5 2 +ORADATA/pgb082/onlinelog/log7a.rdo
    2 6 1 +ORADATA/pgb082/onlinelog/log8b.rdo
    2 6 1 +ORADATA/pgb082/onlinelog/log8a.rdo
    24 rows selected.

Maybe you are looking for

  • Change only material qunatity in sales order by using BAPI

    Hi All, How to change only the material quantity in existing sales order by using BAPI. Please help me in this regards. Regards Deekshitha.

  • System slow after adding sata2 hd k8n-slifi

    hi. recently added a 160gb 7200.9 seagate for more storage space but the system is slower now than before. amd64 3200+ stock speed k8n neo4 sli-fi pc4000 geil 2.5-4-4-9 at pc3200 speed. hitachi 7k250 160gb primary master ibm 30gb primary slave seagat

  • How do I get rid of some apps in my settings?

    There are 2 apps, Sina Weibo and Tencent Weibo listed under the settings tab, but they aren't installed and I don't want them. They must have come with something I (or my kids) downloaded. How do I delete them? I'm trying not to install them to then

  • About forms builder 6i's tab page

    when tab page is changed from one to another which triggers will be fired in order?? (click the topmost Tab Page ) thanks Edited by: user650991 on Apr 16, 2009 6:11 PM

  • Mariadb failed to start again [solved]

    mariadb is not starting, or restarting.  i have poured over topics, tried a few things, but not really sure where to go next. $ journalctl -xn -- Logs begin at Fri 2014-09-19 23:05:01 PDT, end at Sun 2014-10-26 15:07:23 PDT. -- Oct 26 15:05:53 falcon