REG:- SQL QUERY

HI FRENDS
MY PROBLEM IS IN BELOW QUERY
select SUBSTR('Sales - Alternate Channels (Sub Department).Area Manager.1',1,7) from dual
HERE I WANT TO TAKE ONLY 'SALES' FROM THE STRING.
BUT SOME TIME INSTEAD OF SALES IT WILL COME 'Branch Operations' LIKE THAT THEN I WANT TAKE THESE STRING ONLY....
IN SHORT I WAN TO TAKE ONLY THAT STRING WHICH IS BEFORE '-'......NOT THAT VALUE WHICH AFTER '-'...
PL HELP.

If u want srting before '-' than use instr to search '-'
e.g.
select substr('Branch Operations - Alternate Channels (Sub Department).Area Manager.1',1
,instr('Branch Operations - Alternate Channels (Sub Department).Area Manager.1','-',1)-1)
from dual
SQL> select substr('Branch Operations - Alternate Channels (Sub Department).Area Manager.1',1
2 ,instr('Branch Operations - Alternate Channels (Sub Department).Area Manager.1','-',1)-1)
3 from dual
4 /
SUBSTR('BRANCHOPERATIONS-ALTER
Branch Operations
SQL> select substr('Sales - Alternate Channels (Sub Department).Area Manager.1',1
2 ,instr('Sales - Alternate Channels (Sub Department).Area Manager.1','-',1)-1)
3 from dual
4 /
SUBSTR('SALES-ALTERNATECHANNEL
Sales

Similar Messages

  • Reg: sql query that prints all sundays in the year

    Hi all,
    Please give me sql query that prints all sundays in year. And when ever we execute that query then that will prints the sysdate(that is execution date).
    Thanks in Advance,
    -prasad.
    Edited by: prasad_orcl on Jun 5, 2009 9:13 PM

    Hi,
    Plz try this and let me know this works or not...
    SELECT DATE DATES,TO_CHAR(DATE,'DAY') DAYS FROM FISCAL_CALENDAR
    WHERE DATE_YEAR = 2009 AND
    DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND
    ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12) -1 AND
    TRIM(TO_CHAR(DATE,'DAY')) = 'SUNDAY'
    ORDER BY DATE
    OUTPUT:
    DATES     DAYS
    1/4/2009     SUNDAY
    1/11/2009     SUNDAY
    1/18/2009     SUNDAY
    1/25/2009     SUNDAY
    2/1/2009     SUNDAY
    2/8/2009     SUNDAY
    2/15/2009     SUNDAY
    2/22/2009     SUNDAY
    3/1/2009     SUNDAY
    3/8/2009     SUNDAY
    3/15/2009     SUNDAY
    3/22/2009     SUNDAY
    3/29/2009     SUNDAY
    4/5/2009     SUNDAY
    4/12/2009     SUNDAY
    4/19/2009     SUNDAY
    4/26/2009     SUNDAY
    5/3/2009     SUNDAY
    5/10/2009     SUNDAY
    5/17/2009     SUNDAY
    5/24/2009     SUNDAY
    5/31/2009     SUNDAY
    6/7/2009     SUNDAY
    6/14/2009     SUNDAY
    6/21/2009     SUNDAY
    6/28/2009     SUNDAY
    7/5/2009     SUNDAY
    7/12/2009     SUNDAY
    7/19/2009     SUNDAY
    7/26/2009     SUNDAY
    8/2/2009     SUNDAY
    8/9/2009     SUNDAY
    8/16/2009     SUNDAY
    8/23/2009     SUNDAY
    8/30/2009     SUNDAY
    9/6/2009     SUNDAY
    9/13/2009     SUNDAY
    9/20/2009     SUNDAY
    9/27/2009     SUNDAY
    10/4/2009     SUNDAY
    10/11/2009SUNDAY
    10/18/2009SUNDAY
    10/25/2009SUNDAY
    11/1/2009     SUNDAY
    11/8/2009     SUNDAY
    11/15/2009SUNDAY
    11/22/2009SUNDAY
    11/29/2009SUNDAY
    12/6/2009     SUNDAY
    12/13/2009SUNDAY
    12/20/2009SUNDAY
    12/27/2009SUNDAY
    Regards
    Thiyag

  • Reg : SQL query or Function -

    Hi Experts,
    I'm in a fix between 2 approaches.
    Scenario :
    There are 2 tables say LIT (contains Literature docs) and DIAG (contains Diagams). There's some concept called 'Base number' and 'Revision' for both the tables.
    Ex - If Literature (or Diagram) is 1 then this is the 'Base number' and further revisions to this forms - 1A, 1B, 1C...
    Similarly, 2 and 2A, 2B, 2C...
    Inside a package I need to find out for each Base Lit and Base Diagram, their latest revisions.
    Approach [1] :
    Create 2 functions (1 for Lit and other for Diag) where we'll take input as a Base No and fetch its latest.
    Approach [2] :
    Create 2 queries, we'll use SUBSTR for all lits, find the Base no and use analytic funtions like ROW_NUMBER() and find the latest revision.
    Which of the 2 will be more efficient?
    In which 'context switch' will be an overhead or any other concerns?
    Help much appreciated.
    Thanks,
    Ranit
    Oracle version : Oracle Database 10g Enterprise Edition Release *10.2.0.5.0* - 64bi

    ranit B wrote:
    Hi Experts,
    I'm in a fix between 2 approaches.
    Scenario :
    There are 2 tables say LIT (contains Literature docs) and DIAG (contains Diagams). There's some concept called 'Base number' and 'Revision' for both the tables.
    Ex - If Literature (or Diagram) is 1 then this is the 'Base number' and further revisions to this forms - 1A, 1B, 1C...
    Similarly, 2 and 2A, 2B, 2C...
    Inside a package I need to find out for each Base Lit and Base Diagram, their latest revisions.
    Approach [1] :
    Create 2 functions (1 for Lit and other for Diag) where we'll take input as a Base No and fetch its latest.
    Approach [2] :
    Create 2 queries, we'll use SUBSTR for all lits, find the Base no and use analytic funtions like ROW_NUMBER() and find the latest revision.
    Oracle version : Oracle Database 10g Enterprise Edition Release *10.2.0.5.0* - 64biSince others have already expressed opinions about Context Switches, and I favor them, so I would not comment on it. And I will suggest to opt Approach 2.
    Because, you would be able to harness the powers of FBI over the Columns storing versions and better the performance.
    Another approach, I feel, worth trying is to have an MView, that separates the Base number and Max Version Number of the corresponding base number, which would be refreshed on Commit/some other way suitable for your situation.

  • Reg: sql query output

    hi All, 
    select  substr(16878575,1, (length(16878575)-length(substr(16878575, -2,2)))) ||'.' || substr(16878575, -2,2) from dual;
    output - 168785.75. getting correct output.
    Can you please let me know is there any other way to do that?
    thanks in advance.

    This way, if you need to get a number with Two Decimal places.
    with data as
      select 16878575 col from dual
    select col/100 col from data;
    COL                   
    168785.75

  • Need Help Reg SQL Query

    Hi,
    I Have a table with below structure
    Change_Type Old_Val New_val
    AB 1 2
    BC 11 12
    AB 21 22
    BC 31 32
    CD 41 42
    CD 51 52
    Requirement is to display the records in following fashion.
    AB 1 2
    BC 11 12
    CD 41 42
    AB 21 22
    BC 31 32
    CD 51 52

    try this
    with t as
    select 'AB' a, 1 b, 2 c from dual
    union
    select 'BC' a, 11 b,12 c from dual
    union
    select 'AB' a, 21 b,22 c from dual
    union
    select 'BC' a, 31 b,32 c from dual
    union
    select 'CD' a, 41 b,42 c from dual
    union
    select 'CD' a, 51 b,52 c from dual
    select a,b,c from(select a, b, c, row_number() over (partition by a order by b) rn from t) order by rn,a,b

  • Reg how an sql query works?

    I am new to Oracle and sql/plsql. What is the background processes happening when an sql query is fired to the database?
    In short how an sql query is actually working?
    what are the steps involved in it?
    pls provide me the links if it is tedious to reply
    Thanks

    Every SQL-Select Statement meets three stages parse, execute, and fetch. To know completely how SQL and PL/SQL work with Oracle, you must have to read the below Oracle Link seriously.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/sqlplsql.htm
    Regards,
    Sabdar Syed.

  • Reg : Exection time of SQL query

    Hi All,
    How to identify the oracle sql query exection time.
    Thanks in Advance.

    Hi,
    try This
    SQL> set timing on;
    SQL> select * from dual;
    D
    X
    Elapsed: 00:00:00.00
    SQL> set timing off;
    SQL> select * from dual;
    D
    XReagrds
    umi

  • CUCM SQL Query - MGCP EPs IP Addresses

    Hello,
    CUCM 9.x.
    Could you please advice me the CLI sql query to get registered MGCP endpoints IP addresses?
    Thank you in advance.

    Hi,
    these IP's aren't stored in the SQL DB.
    Try RISDB:
    admin:show risdb query gateway
    ----------- Gateway Information -----------
    Number of Gateway entries: 412
    #registered, #unregistered, #rejected, StateId, #ExpUnreg
    216, 14, 182, 13605, 0
    Seq#, Gateway Name, IPAddress, IPv6Address, Desription, DChannel #, DChannel Status, Perf Object, Reg Status, Model Type, Http Support, #Reg Attempts, Prod Id, Box Prod Id, RegStatChg TimeStamp
    1, BRI/S0/SU0/[email protected], 10.14.71.44, , BRI/S0/SU0/[email protected], 0, UP, 12, unr, 121, no, 0, 90, 30060, 1425375416
    Regards
    Andre

  • "SQL Query in HTTP Request" (5474:0)

    Hi,
    The IDS signature "SQL Query in HTTP Request" (5474:0) does not recognize all malicious SQL selects. Currently, the reg exp looks like [%]20|[=]|[+])[Ss][Ee][Ll][Ee][Cc][Tt]([%]20|[+])[^\r\n\x00-\x19\x7F-\xFF]+([%]20|[+])[Ff][Rr][Oo][Mm]([%]20|[+] . We noticed that subselects does not trigger the signature. For example, "...(select%20something%20from%20somethingmore%20where%20variable%20=%20(select%20....." which could be malicious. Is there any possibility to include "(" in the regexp to detect subselects?
    Regards,
    /Ola

    hmmm...That should actually match just fine. Let's break it down:
    ([%]20|[=]|[+]) <--"%20","=",or "+"
    [Ss][Ee][Ll][Ee][Cc][Tt] <-- "SELECT"
    ([%]20|[+]) <--"%20" or "+"
    [^\r\n\x00-\x19\x7F-\xFF]+ <-- NOT one or more ascii control or extended chars
    ([%]20|[+]) <-- "%20" or "+"
    [Ff][Rr][Oo][Mm] <-- "FROM"
    ([%]20|[+]) <-- "%20" or "+"
    The only reason I can think that it wouldn't match is if there some funky characters between the first SELECT and the first FROM (i.e. carriage return/line feed, etc). Also remember that a %20 or = or + must precede the SELECT and that a %20 or + must follow the FROM.

  • How to modify a SQL query?

    Hi all,
    I am using Crystal Reports version 10. I have a number of reports that have been written by a software vendor wherby the name of the database they were connected to when the report was written is coded into the FROM command of the reports SQL query, eg "GCUK_2" in the of the SQL snippet below.
    SELECT "Clients"."NAME", "Quotes"."QUOTE_ID", "Quote_Items"."UPRICE", "Quote_Items"."QTY", "Quote_Items"."UOM", "Quote_Items"."QUSAGE_ID", "Report_Control"."QUSAGEID", "Quote_Items"."STANDARD", "Quote_Items"."SECT_FLAG", "Quote_Items"."DISPORDER", "Quotes"."DESCRIPT", "Report_Control"."SECT_NAME", "Quote_Items"."CNT", "Category_and_Type"."TYPEDESC", "Quote_Items"."DESCRIPT", "Report_Control"."DISP_SORT"
    FROM   ((("GCUK_2"."schedwin"."QTE_CTRL" "Report_Control" INNER JOIN "GCUK_2"."schedwin"."QUSAGE" "Quote_Items" ON "Report_Control"."QUSAGEID"="Quote_Items"."QUSAGE_ID") LEFT OUTER JOIN "GCUK_2"."schedwin"."QUOTES" "Quotes" ON
    I have tried setting the Datasource Location, but it doesn't change the query at all. I have read on another forum that you can generate another SQL query using the Database Expert, Current Connections, then right click the Add Command for the database you want to create a SQL command. Is this the only way to update the database names in the query?
    Thanks,
    Scott.

    Hi Sourashree,
    Thanks for that. All the reports were created by the vendor using tables as opposed to the command object. I would have thought that changing the datasource would automatically cause Crystal to rewrite the SQL query syntax, but this doesn't appear to be the case.
    Yes, I've noticed that modifying the record selection will change the sql query. The only way I can see to change the database name in the query is to change to the desired databsource and then remove and re-insert the tables, which will then update the query with the correct name. However, this seems to be a convoluted way of changing the db name in the query.

  • Discoverer Report showing Null VS Show SQL query showing results !!!

    I created a simple Cross Tab Discoverer report from a custom SQL which has a calculation for balances. The output is giving all null values even though there are balances. The output doesn't seem right. So I copied the query from Tools-->Show SQL and ran the query in the TOAD where I'm showing balances for the report. I don't understand why it is not showing in the discoverer. Please help.
    Thanks
    Edited by: PA1B on Jan 27, 2010 11:40 AM

    Sorry for late reply.
    Below is the Show SQL query. I don't think the query is application dependent. C_1 is my calculation.
    SELECT o279709.SEGMENT3 as E279727,
    o279709.SEGMENT4 as E279728,
    CASE WHEN o279709.CURRENCY_CODE = 'USD' AND o279709.TRANSLATED_FLAG <> 'Y' THEN SUM(o279709.ENDING_BAL) ELSE 0 END as C_1,
    GROUPING_ID(o279709.CURRENCY_CODE,o279709.SEGMENT3,o279709.SEGMENT4,o279709.TRANSLATED_FLAG) as GID
    FROM ( --Foriegn Entity USD Balances
    SELECT                B.SEGMENT1,
                                       B.SEGMENT2,     
                                       B.SEGMENT3,
                                  (select distinct substr(cat.COMPILED_VALUE_ATTRIBUTES,5,1) from apps.fnd_flex_values cat
                   where FLEX_VALUE_SET_ID = (select bat.FLEX_VALUE_SET_ID from apps.fnd_id_flex_structures_vl aat, apps.fnd_id_flex_segments_vl bat
                                                                                                                       where bat.id_flex_code = 'GL#' and
                                                                                                                            bat.id_flex_code = aat.id_flex_code and
                                                                                                                            aat.APPLICATION_ID = bat.APPLICATION_ID and
                                                                                                                            aat.APPLICATION_ID = 101 and
                                                                                                                            bat.SEGMENT_NAME = 'Prime Account' and
                                                                                                                            aat.id_flex_num = bat.id_flex_num
                                                                                                                            and bat.id_flex_num in (select distinct chart_of_accounts_id from apps.gl_code_combinations gat
                                                                                                                                                                              where gat.code_combination_id = A.code_combination_id))
                                       and cat.flex_value = b.segment3) ACCT_TYPE ,
                                       B.SEGMENT4,
                                       B.SEGMENT5,
                                       B.SEGMENT6,
                                       B.SEGMENT7,
                                       B.SEGMENT8,
                                       B.SEGMENT9,
                                       B.SEGMENT10,
                                       B.SEGMENT11,
                                       B.SEGMENT12,
                                       B.SEGMENT13,
                                       C.NAME,
    A.SET_OF_BOOKS_ID,
                                       A.CURRENCY_CODE,A.TRANSLATED_FLAG,
                                  SUM(NVL(A.BEGIN_BALANCE_DR,0) - NVL(A.BEGIN_BALANCE_CR,0)) BEG_BAL,
                                  SUM(NVL(A.PERIOD_NET_DR,0)) DEBITS,
    SUM( NVL(A.PERIOD_NET_CR,0)) CREDITS ,
    A.PERIOD_NAME,
                                  SUM(NVL(A.BEGIN_BALANCE_DR,0) - NVL(A.BEGIN_BALANCE_CR,0))+ SUM(NVL(A.PERIOD_NET_DR,0) - NVL(A.PERIOD_NET_CR,0)) ENDING_BAL
    FROM                     APPS.GL_BALANCES A ,
                                       APPS.GL_CODE_COMBINATIONS B,
                                       APPS.GL_SETS_OF_BOOKS     C
    WHERE                     A.CODE_COMBINATION_ID = B.CODE_COMBINATION_ID
    --AND                           A.PERIOD_NAME = 'SEP-09'
    AND                          C.SET_OF_BOOKS_ID = A.SET_OF_BOOKS_ID
    --AND                           A.TRANSLATED_FLAG <> 'Y'
    --AND                           B.SEGMENT1 = '83101'
    --AND                           B.SEGMENT3 = '14602'
    --AND                           A.SET_OF_BOOKS_ID = 77
    --AND                           A.CURRENCY_CODE = 'USD'
    GROUP BY           A.CODE_COMBINATION_ID,
                                  B.SEGMENT1,
                                       B.SEGMENT2,     
                                       B.SEGMENT3,
                                       B.SEGMENT4,
                                       B.SEGMENT5,
                                       B.SEGMENT6,
                                       B.SEGMENT7,
                                       B.SEGMENT8,
                                       B.SEGMENT9,
                                       B.SEGMENT10,
                                       B.SEGMENT11,
                                       B.SEGMENT12,
                                       B.SEGMENT13,          
                                       A.CURRENCY_CODE,
                                       A.TRANSLATED_FLAG,
                                       C.NAME,A.PERIOD_NAME,
    A.SET_OF_BOOKS_ID
    ) o279709
    WHERE (o279709.PERIOD_NAME = 'DEC-09')
    AND (o279709.SET_OF_BOOKS_ID <> 72)
    AND (o279709.SEGMENT12 = '000')
    AND (o279709.SEGMENT3 IN ('10101','10301','10502','12001'))
    AND (o279709.SEGMENT1 IN ('82901','82902','82903','83001','83003','83201'))
    GROUP BY GROUPING SETS(( o279709.CURRENCY_CODE,o279709.SEGMENT3,o279709.SEGMENT4,o279709.TRANSLATED_FLAG ),( o279709.SEGMENT3,o279709.SEGMENT4 ),( o279709.SEGMENT3 ))
    HAVING (GROUP_ID()=0)
    ORDER BY GID DESC;
    Thanks,
    PA1
    Edited by: PA1B on Jan 29, 2010 12:50 PM

  • Error while executing a sql query for select

    HI All,
    ORA-01652: unable to extend temp segment by 128 in tablespace PSTEMP i'm getting this error while i'm executing the sql query for selecting the data.

    I am having 44GB of temp space, while executing the below query my temp space is getting full, Expert please let us know how the issue can be resolved..
    1. I dont want to increase the temp space
    2. I need to tune the query, please provide your recomendations.
    insert /*+APPEND*/ into CST_DSA.HIERARCHY_MISMATCHES
    (REPORT_NUM,REPORT_TYPE,REPORT_DESC,GAP,CARRIED_ITEMS,CARRIED_ITEM_TYPE,NO_OF_ROUTE_OF_CARRIED_ITEM,CARRIED_ITEM_ROUTE_NO,CARRIER_ITEMS,CARRIER_ITEM_TYPE,CARRIED_ITEM_PROTECTION_TYPE,SOURCE_SYSTEM)
    select
    REPORTNUMBER,REPORTTYPE,REPORTDESCRIPTION ,NULL,
    carried_items,carried_item_type,no_of_route_of_carried_item,carried_item_route_no,carrier_items,
    carrier_item_type,carried_item_protection_type,'PACS'
    from
    (select distinct
    c.REPORTNUMBER,c.REPORTTYPE,c.REPORTDESCRIPTION ,NULL,
    a.carried_items,a.carried_item_type,a.no_of_route_of_carried_item,a.carried_item_route_no,a.carrier_items,
    a.carrier_item_type,a.carried_item_protection_type,'PACS'
    from CST_ASIR.HIERARCHY_asir a,CST_DSA.M_PB_CIRCUIT_ROUTING b ,CST_DSA.REPORT_METADATA c
    where a.carrier_item_type in('Connection') and a.carried_item_type in('Service')
    AND a.carrier_items=b.mux
    and c.REPORTNUMBER=(case
    when a.carrier_item_type in ('ServicePackage','Service','Connection') then 10
    else 20
    end)
    and a.carrier_items not in (select carried_items from CST_ASIR.HIERARCHY_asir where carried_item_type in('Connection') ))A
    where not exists
    (select *
    from CST_DSA.HIERARCHY_MISMATCHES B where
    A.REPORTNUMBER=B.REPORT_NUM and
    A.REPORTTYPE=B.REPORT_TYPE and
    A.REPORTDESCRIPTION=B.REPORT_DESC and
    A.CARRIED_ITEMS=B.CARRIED_ITEMS and
    A.CARRIED_ITEM_TYPE=B.CARRIED_ITEM_TYPE and
    A.NO_OF_ROUTE_OF_CARRIED_ITEM=B.NO_OF_ROUTE_OF_CARRIED_ITEM and
    A.CARRIED_ITEM_ROUTE_NO=B.CARRIED_ITEM_ROUTE_NO and
    A.CARRIER_ITEMS=B.CARRIER_ITEMS and
    A.CARRIER_ITEM_TYPE=B.CARRIER_ITEM_TYPE and
    A.CARRIED_ITEM_PROTECTION_TYPE=B.CARRIED_ITEM_PROTECTION_TYPE
    AND B.SOURCE_SYSTEM='PACS'
    Explain Plan
    ==========
    Plan
    INSERT STATEMENT ALL_ROWSCost: 129 Bytes: 1,103 Cardinality: 1                                                        
         20 LOAD AS SELECT CST_DSA.HIERARCHY_MISMATCHES                                                   
              19 PX COORDINATOR                                              
                   18 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10002 :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1                                         
                        17 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1                                    
                             15 HASH JOIN RIGHT ANTI NA PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,098 Cardinality: 1                               
                                  4 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 63 Bytes: 359,283 Cardinality: 15,621                          
                                       3 PX SEND BROADCAST PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621                     
                                            2 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621                
                                                 1 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621           
                                  14 NESTED LOOPS ANTI PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 40,256,600 Cardinality: 37,448                          
                                       11 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 6,366,160 Cardinality: 37,448                     
                                            8 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1002               
                                                 7 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 1 Bytes: 214 Cardinality: 2           
                                                      6 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 1 Bytes: 214 Cardinality: 2      
                                                           5 INDEX FULL SCAN INDEX CST_DSA.IDX$$_06EF0005 Cost: 1 Bytes: 214 Cardinality: 2
                                            10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448                
                                                 9 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448           
                                       13 TABLE ACCESS BY INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT CST_DSA.HIERARCHY_MISMATCHES :Q1002Cost: 0 Bytes: 905 Cardinality: 1                     
                                            12 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT SYS.HIERARCHY_MISMATCHES_IDX3 :Q1002Cost: 0 Cardinality: 1                
                             16 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT CST_DSA.IDX$$_06EF0001 :Q1002Cost: 1 Bytes: 5 Cardinality: 1

  • Issue in creation of group in oim database through sql query.

    hi guys,
    i am trying to create a group in oim database through sql query:
    insert into ugp(ugp_key,ugp_name,ugp_create,ugp_update,ugp_createby,ugp_updateby,)values(786,'dbrole','09-jul-12','09-jul-12',1,1);
    it is inserting the group in ugp table but it is not showing in admin console.
    After that i also tried with this query:
    insert into gpp(ugp_key,gpp_ugp_key,gpp_write,gpp_delete,gpp_create,gpp_createby,gpp_update,gpp_updateby)values(786,1,1,1,'09-jul-12',1,'09-jul-12',1);
    After that i tried with this query.but still no use.
    and i also tried to assign a user to the group through query:
    insert into usg(ugp_key,usr_key,usg_priority,usg_create,usg_update,usg_createby,usg_updateby)values(4,81,1,'09-jul-12','09-jul-12',1,1);
    But still the same problem.it is inserting in db.but not listing in admin console.
    thanks,
    hanuman.

    Hanuman Thota wrote:
    hi vladimir,
    i didn't find this 'ugp_seq'.is this a table or column?where is it?
    It is a sequence.
    See here for details on oracle sequences:
    http://www.techonthenet.com/oracle/sequences.php
    Most of the OIM database schema is created with the following script, located in the RCU distribution:
    $RCU_HOME/rcu/integration/oim/sql/xell.sql
    there you'll find plenty of sequence creation directives like:
    create sequence UGP_SEQ
    increment by 1
    start with 1
    cache 20
    to create a sequence, and
    INSERT INTO UGP (UGP_KEY, UGP_NAME, UGP_UPDATEBY, UGP_UPDATE, UGP_CREATEBY, UGP_CREATE,UGP_ROWVER, UGP_DATA_LEVEL, UGP_ROLE_CATEGORY_KEY, UGP_ROLE_OWNER_KEY, UGP_DISPLAY_NAME, UGP_ROLENAME, UGP_DESCRIPTION, UGP_NAMESPACE)
    VALUES (ugp_seq.nextval,'SYSTEM ADMINISTRATORS', sysadmUsrKey , SYSDATE,sysadmUsrKey , SYSDATE, hextoraw('0000000000000000'), 1, roleCategoryKey, sysadmUsrKey, 'SYSTEM ADMINISTRATORS', 'SYSTEM ADMINISTRATORS', 'System Administrator role for OIM', 'Default');
    as a sequence usage example.
    Regards,
    Vladimir

  • Using a SQL Query in an Alert and Matching a String

    I've created an alert in 12.0.4 using a SQL Query and the field that I'm trying to match is a string.  Originally the query returned multiple rows but when the alert still didn't fire, I modified the query WHERE clause to return only one row:
    NAME                                RESPONSE
    Are area lights working?            No
    My expression in the metric is RESPONSE.  In the Monitor I'm matching a string equal to No.  (Do I need double quotes around the matchvalue?  Single quotes?  No quotes?)  The metric is in the 15min scan group, the role is xMII Developers and I'm in that role. The monitor alert string is ' =  '.  Both metric and monitor are active and I've subscribed to the monitor.  Other alerts in the 15min scan group (all based on tag queries) are firing off properly.
    Why is nothing showing up in the Alert Log?
    David Macindoe

    David,
    Did you figure out the answer?  If not, I will try to find someone to address your question.
    Mike

  • Use realational operators in an SQL query??????

    does any one knows how to use realational operators in an SQL query??????
    i wud like to do something like
    select decode(2<3,sysdate,sydate +1) from dual
    but i know decode does not supports relational operators......
    thanx and Regards
    amyt

    You can use a CASE statement which does support relational operators, or if you must use DECODE, then you can use something like:
    SELECT DECODE(SIGN(2 - 3),-1,sysdate,sysdate - 1)
    FROM dual;The SIGN function returns -1 if the expression is < 0, 1 if the expression is > 0 and 0 if the expression is 0. This works for numeric comparisions. You can use the GREATEST or LEAST functions in a similar fashion for character comparisions.
    TTFN
    John

Maybe you are looking for