Prioritizing a set by using union operator

My requirement is to print data whose log_in_id starts with a and end with y first, then to print data starting with a and b.
select * from userid where log_in_id like 'a%y' union select * from userid where log_in_id like 'a%' or log_in_id like 'b%'

Why go through the table twice? I would do something like:
SQL> SELECT log_in_id
  2  FROM (SELECT 'bob' log_in_id FROM dual
  3        UNION ALL
  4        SELECT 'bill' from dual
  5        UNION ALL
  6        SELECT 'ally' from dual
  7        UNION ALL
  8        SELECT 'abby' from dual
  9        UNION ALL
10        SELECT 'allen' from dual
11        UNION ALL
12        SELECT 'albert' from dual)
13  ORDER BY CASE WHEN log_in_id LIKE 'a%y' THEN 1 ELSE 2 END,
14           log_in_id;
LOG_IN
abby
ally
albert
allen
bill
bobHTH
John

Similar Messages

  • Writing query using UNION Operator

    Question -
    (1)
    Write an SQL Statement to list the following items: Customer ID, Customer Name, number of invoices, sum of total for invoices. Ensure that all customers are returned in the result set.
    Answer for the above is written as below by one person. That seams to be correct. Is there another way of writing this same query.;
    select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
    from gee_customer c,(select customer_id,count(*) as cnt, sum(TOTAL) as s
    from gee_invoice
    group by customer_id) i
    where c.CUSTOMER_ID = i.customer_id (+)
    (2)
    My other question is How to write the above answer (or what you sugest) using UNION operator ?
    Any ideas please
    Message was edited by:
    user483578

    In fact the outer join means you use the union of two result sets - usual join result
    and the rows from the outer table for which there is not any row in the inner table.
    SQL> select d.deptno, e.ename from emp e, dept d
      2  where d.deptno = e.deptno(+)
      3  order by 1,2
      4  /
        DEPTNO ENAME
            10 CLARK
            10 KING
            10 MILLER
            20 ADAMS
            20 FORD
            20 JONES
            20 SCOTT
            20 SMITH
            30 ALLEN
            30 BLAKE
            30 JAMES
            30 MARTIN
            30 TURNER
            30 WARD
            40
    15 rows selected.
    SQL> select d.deptno,e.ename from emp e, dept d
      2  where d.deptno = e.deptno
      3  union
      4  select deptno, null
      5  from dept d where not exists (select null from emp e where e.deptno = d.deptno)
      6  order by 1,2
      7  /
        DEPTNO ENAME
            10 CLARK
            10 KING
            10 MILLER
            20 ADAMS
            20 FORD
            20 JONES
            20 SCOTT
            20 SMITH
            30 ALLEN
            30 BLAKE
            30 JAMES
            30 MARTIN
            30 TURNER
            30 WARD
            40
    15 rows selected.In your example something like (NOT tested !)
    with i as (select customer_id,count(*) as cnt, sum(TOTAL) as s
    from gee_invoice group by customer_id)
    select c.CUSTOMER_ID,c.NAME,i.cnt,i.s
    from gee_customer c, i
    where c.CUSTOMER_ID = i.customer_id
    union
    select c.CUSTOMER_ID,c.NAME,null,null
    from gee_customer c
    where not exists (select null from i where c.CUSTOMER_ID = i.customer_id)
    Rgds.

  • Creating table or View using UNION Operator ???????

    Hi all
    please need some help ,i have created aquery using UNION operator
    (i.e
    select A,to_number(null),C from table1
    Union
    select A,B,To_number(null) from table2)
    it gives the output correctly and i need to make this output as View ot table
    eacg time i use
    Create or replace view v_1 ...........
    it gives me this error :: unknown command "UNION" - rest of line ignored.
    can any one pls tell me what to do
    Thanks

    Hi,
    I found there is no error in your sql
    create view x_v
    as
    select a from x
    union
    select to_number(null) from y;
    this works fine.
    in your sql check your right or left peranthesis
    regards
    Ripudaman

  • Using union operator in discoverer

    Hi All,
    I have a sql statement which is to be implemented in discoverer:
    (select ........where user_entered_date='YYYY/MM/DD' )
    UNION
    (select ........where user_entered_date='YYYY/MM/DD'
    AND (select ........where user_entered_date='YYYY/MM/DD' ))
    Problem:
    a) There are nested select statements which require parameters to be entered by the user.
    b) How would I implement the union operator in the above scenario?
    I would really appreciate it if someone could give a work around.
    Regards,
    Nav

    Hi,
    Unfortunately, we can not have a SQL query with Union in Discoverer directly.
    You should create a view based on the complete query and then create folder using the view.
    You can provide a parameter at the report level.
    For eg :
    View query : select as_of_date from table_name
    Report : Add a paremeter for as_of_date
    Hope this Helps!
    Yogini

  • UNION operator in ejb 3.0

    Hi All,
    I have to use UNION operator in my ejb ql. My underlying database is MySQL.
    My ejb ql is
    SELECT s from eee s where s.name like 'XXX'
    UNION
    SELECT t from eee t where t.default_id = 'XXX'
    union is on the same entitybean.
    In my eee entity bean I have tried
    @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
    Ejb ql doesnot return the expected results.
    Could someone please help me out with UNION operator in ejb 3.0
    Thanks

    you should have little problems, but just how little is container specific. I successfully run JEE 1.4 stuff on JBoss 5.1 for example without having to make any configuration changes. Heck, I mix that technology with EJB 3 tech, even having shared container managed transactions.
    BTW: you mean JEE5, not J2SE 1.5. Big difference in what they represent.

  • ROWNUM in UNION operator

    All,
    I have a requirement in SQL that I have to number each row. Hence I thought of using ROWNUM. But the sql query I'm using uses UNION operator. Hence I used like this
    select a,b,rownum as 'field1' from table1
    union
    select c,d,1 as 'field1' from table2
    Will the above query solve my purpose?
    thanks
    sen

    jeneesh wrote:
    This will probably kill the purpose of UNION - which is to take only the DISTINCT rows..
    If DISTINCT is not intended, it is better to choose UNION ALLYes, you are correct about use of UNION. Probably, OP would have wanted to use Union ALL perhaps, but might have forgotten about suppressing of duplicates and sorting and ended up using Union.
    But, in accordance with the original query used by OP, my suggestion of row number would not affect the output, I guess, would it?
    Perhaps, if OP would have provided us with some base sample data and the Output desired from it, it would have been of greater help.

  • How to use union statement with declare & set function?

    Hi Experts,
            i  have small query about how to use union statement with declare & set function?
    Example as below :
    DECLARE @name AS date
    Declare @name2  AS date
    /* SELECT FROM [2013].[dbo].[OINV] T0 */
    /* WHERE */
    SET @name = /* T0.DocDate */ '[%1]'
    SET @name2 = /* T0.DocDate */ '[%2]'
    select  '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2013.dbo.orct t1
    inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2013.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]
    Union
    /* SELECT FROM [2014].[dbo].[OINV] T0 */
    /* WHERE */
    SET @name = /* T0.DocDate */ '[%1]'
    SET @name2 = /* T0.DocDate */ '[%2]'
    select  '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2014.dbo.orct t1
    inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2014.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]

    You have to create stored procedure in SQL only .
    Like u must have create for Crystal .
    You can execute procedure in query manager but you have to enter parameter manually..
    example
    Exec @Test '20140101' '20140501'
    Every time user has to enter it manually in yyyymmdd format in case of date parameters.
    Example
    Create Proc [@Test]
    as begin
    DECLARE @name AS date
    Declare @name2  AS date
    /* SELECT FROM [2013].[dbo].[OINV] T0 */
    /* WHERE */
    select  '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2013.dbo.orct t1
    inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2013.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between @Name and @Name2
    Union
    /* SELECT FROM [2014].[dbo].[OINV] T0 */
    /* WHERE */
    select  '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2014.dbo.orct t1
    inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2014.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between
    between @Name and @Name2
    end

  • Rework using reference operation set

    Dear Gurus,
    Am working in an ECC 6.0 environment.
    Want to create rework order using reference operation set.
    Master data created:
    BoM
    Reference Operation set to which the header material is assigned to which a BoM is assigned.
    The settings in OPL8 for order type ZXXX are:
    Production version :  manual selection
    Routing:
    Application: Routing
    Selection Id: RW (priority 01, task list type 'S', and usage 1)
    Task list type: S
    Routing Selection: 4
    BoM:
    Application: PP01
    Create a production order (CO01), with order type ZXXX. The system asks to select the task list group once the order quantity and dates are entered. On selection of the Group for the reference operation set system generates an error 'No valid BoM exsists for Material xxxxx Plant xxxx'.
    SAP helps says - A reference operation set cannot be used directly in production.
    Am I doing something wrong?
    Your expert advice please.
    Tarang

    Dear first create a reference operation set go to CA11 just press enter without entering anything then enter plant,usage,status and lot size in component allocation you can select the required BOM and assign with the operation.
    and create the order in CO07 enter the plant and order type in next screen don't give any material code give description rework and give the quantity to be reworked and in components give the required components for consumption during rework before this you need to give the reference operation set group and task list in the popup and in settlement rule maintain the category and settlement receiver and save the order.
    You can confirm the order in CO15 by providing the order number and enter the yield quantity to confirm and save.
    Please note that during this rework order confirmation, only Goods issue will happen based on the input given in the components tab rework order and NO GOODS RECIEPT will happen.
    Cheers
    KK

  • Prod.Order Creation- Using Reference Operation set.

    Hi
    While creating a production order of particular order type,after entering the quantity and order finish date as today's date(05.06.2007),backward scehduling,it's showing no routing found for the material (as we are using REM-Repetitive manufacturing,we are having rate routing) ,and in the same mesaage box itself I choosed the Reference operation set(that I have created today) and entered the  group no,and after entering its showing me an error as <b>Ref. operation set 50000008 is not valid according to the selection conditions</b>,
    So I created a routing for the same material nd in MRP4 view of the same material under for selection method i kept blank(Selection by order qunatity) and tried to create Prod.order,and there was no problem,but if the same i'm trying to create using Reference operation set I'm not able to create the Production order.
    Kindly give me a solution for this,Is there anything to do with order type dependent parameters of the particular order type?
    Thanks & Regards
    Raj

    Hi,
    Is your problem solved ?
    One more solution to create a order with reference operation set,is to use a trigger point.
    Once you create a reference operation set.
    Use T.code co31 to create a trigger point, chosoe create order with reference & choose a system status eg: PCNF. & click the user parameter tab.
    The system will aks for the reference operation set no & group counter.
    Then assign this reference operation set to the routing operation.
    When you do partial confirmation of this operation, this will trigger the generation of a order.
    Regards,
    Senthilkumar SD

  • With using the Union oper. query

    Hi Team
    I have table like A and B
    A table Structure
    C1-------C2-------C3
    R1-------R2--------R3
    R4-------R5---------R6
    B table Structure
    C1-----C2
    R11----R8
    my output is like below
    C1-------C2-------C3
    R1-------R2--------R3
    R4-------R5---------R6
    R11----R8----------null
    i can use the Union all condition i don't want to use the
    union all condition who? plz help
    select c1,c2,c3
    union
    select c1,c2;

    870003 wrote:
    Hi Team
    I have table like A and B
    A table Structure
    C1-------C2-------C3
    R1-------R2--------R3
    R4-------R5---------R6
    B table Structure
    C1-----C2
    R11----R8
    my output is like below
    C1-------C2-------C3
    R1-------R2--------R3
    R4-------R5---------R6
    R11----R8----------null
    i can use the Union all condition i don't want to use the
    union all condition who? plz helpWhy don't you want to use union all, because that is exactly what you are trying to achieve?

  • ORA-22950 when selecting geometry and using union

    Any query where results are UNIONed where an sdo_geometry is in the selection list (such as the one below) gives me "ORA-22950 cannot ORDER objects without MAP or ORDER method".
    select p.point_id id, p.geom from point p
    union
    select l.line_id id, l.geom from line l
    Perhaps it's possible to define a map or order method for sdo_geometry (or perhaps not), but I don't want to order by geometry.
    I'm running this within SQL Plus (either 8.1.5.0.0 or 8.1.6.0.0 will do it)
    and am connecting to
    "Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
    With the Partitioning option
    JServer Release 8.1.6.0.0 - Production"
    I tried adding an order by clause to order by id, to no effect.
    Any ideas?

    Hi Ben,
    The use of the union operator tells Oracle only to return a unique set of rows, hence a sort is done (in this case attempted, since there is no geometry sorting routine).
    If you choose union all, then no sort will be attempted.
    Hope this helps,
    dan

  • Need help in restricting a result set from a UNION in MERGE

    Hello,
    Would really appreciate if anybody could help me out with the issue I am facing with the below statements (I am new to Oracle ):
    merge into table_name_1 p
    using
      select p_key, value_1, value_2
      from some_tables
      UNION
      select p_key, value_1, value_2
      from some_tables
      UNION
    )t
    on (p.p_key = t.p_key)
    when matched then
      update table_name_1 with value_1 and value_2
    when not matched then
      insert table_name_1 with p_key, value_1, value_2;
    Now, the union of all those selects gives me distinct values and it works most of the times but when I get values like below, the merge fails:
    p_key-----value_1-----value_2
    100-----25-----50
    100-----NULL-----50
    I browsed the net and understood the reason behind this: the result set becomes ambiguous and merge doesn't know which row to insert first and which one to update.
    Now, my requirement is: I could have any of the below scenario/result sets from the union and I need only 1 row per p_key -
    result_set_1
    p_key-----value_1-----value_2
    100-----25-----50 ***************need this row
    100-----NULL-----50
    100-----NULL-----NULL
    result_set_2
    p_key-----value_1-----value_2
    100-----25-----NULL ***************need this row
    100-----NULL-----NULL
    result_set_3
    p_key-----value_1-----value_2
    100-----25-----NULL ***************need this row (p_key = 100)
    100-----NULL-----NULL
    200-----NULL-----75 ***************need this row (p_key = 200)
    200-----NULL-----NULL
    300-----90-----95 ***************need this row (p_key = 300)
    So, I basically need a way to restrict the values that I will get from the UNION of all those selects to fit the requirement above, hope I was able to explain the issue I am facing.
    Any help would be greatly appreciated.
    Thanks,
    Dpunk

    In all cases the goal is to find an order by value that will make the row you want be first.
    The query I gave is calculating a priority for each row by adding up values showing whether each column is null or not null. The case statements check whether each column is null and need to be added up to give a total priority value.
    Value_1   Value_2   Priority
    Not Null  Not Null  2 + 1 = 3
    Not Null  Null      2 + 0 = 2
    Null      Not Null  0 + 1 = 1
    Null      Null      0 + 0 = 0
    The priority value ends up being a bitmap showing whether each value is null or not null. I think that reflects my mathematics background.
    Another way of getting the same result (suggested to me by your asking why it needs the "+") would be to use two CASE expressions as separate order by items:
    select p_key, value_1, value_2 from
    (select p_key, value_1, value_2, row_number() over
              (partition by p_key
               order by case when value_1 is null then 0 else 1 end DESC,
                        case when value_2 is null then 0 else 1 end DESC
              ) as rn
      from (your UNION query here)
    where rn = 1
    A third way is to use a more complex case statement:
    select p_key, value_1, value_2 from
    (select p_key, value_1, value_2, row_number() over
              (partition by p_key
               order by case when value_1 is NOT null and value_2 is NOT null then 1
                             when value_1 is NOT null and value_2 is     null then 2
                             when value_1 is     null and value_2 is NOT null then 3
                             when value_1 is     null and value_2 is     null then 4
                         end  ASC
              ) as rn
      from (your UNION query here)
    where rn = 1

  • How does one install non-English character sets for use with the "find" function in Acrabat Pro 11?

    I have pdf files in European languages and want to be able to enter non-English characters in the "find" function. How does one install other character sets for use with Acrobat Pro XI?

    Have you tried applying the update by going to Help>Updates within Photoshop Lightroom?  The update should be using the same licensing?  Did you perhaps customize the installation location?  Finally which operating system are you using?

  • Transformations not occuring properly using PIVOT operator in OWB mapping.

    Hi ,
    In our project we have a OWB Map UII_D_MAP_SPC_CUST_FAULT_NATTR which is used to populate UII_CUSTOMER_FAULT table in our target side.
    The source table which populate UII_CUSTOMER_FAULT is SR_S_TABLE_N_ATTRIBUTEVALUE (a materialized view in another External Db)
    This Mview has 2 columns: S_N_STRINGVALUE & N_NAME.
    When N_NAME is 'FAULT_REPORT_CODE' the corresponding S_N_STRINGVALUE value should populate the REPORT_CODE field in UII_CUSTOMER_FAULTin the target sde.
    This source to target transformations is being done by using UNPIVOT operator in this mapping UII_MAP_SPC_CUST_FAULT_NATTR.
    In ideal case when S_N_STRINGVALUE is NOT NULL, REPORT_CODE value should be populated with the value of source field value (ie the value of S_N_STRINGVALUE) and when S_N_STRINGVALUE is NULL , REPORT_CODE should be populated with 'XX'.
    But in some cases REPORT_CODE value in UII_CUSTOMER_FAULT table is populated as NULL when S_N_STRINGVALUE is NOT NULL
    which should not happen.
    We suspect that there is some prpblem in the UNPIVOT operator, but we are not able to track down the exact location where it is failing. Can you please help in resolving this problem?
    Shall we remove Unpivot operator and use CASE statement in some package that will be called through Expression operator?
    Please advise.
    Regards
    Arinjit Dhar

    Arinjit,
    Have got any solution forthis. Today I ran into exactly the same problem. If you have got the solution, can you please post it in the forum.
    Ott Karesz,
    I have posted my SQL which got generated. The problem is when I am running the SQL just for the particular data set, it is giving the output properly. But what confuses me more is, when I run the mapping just for few records, it is populating the values correctly, but when running the mapping for all the records, then it populates null values for those records.
    Generated SQL:
    INSERT
    INTO
    "TB_PIPE_1"
    ("ASSETNUM",
    "SITEID",
    "TYPE",
    "STATUS",
    "YEARLAID",
    "MATERIALCODE",
    "PRESSURECODE",
    "DIAMETER",
    "METHODLAID",
    "JOINTTYPE",
    "SDRCOL",
    "LENGTHLAID",
    "LENGTHDIGITISED",
    "MEASUREUNITID")
    SELECT
    "UNPIVOT"."ASSETNUM" "ASSETNUM$1",
    "UNPIVOT"."SITEID" "SITEID$1",
    "UNPIVOT"."CLASSIFICATIONID" "CLASSIFICATIONID$1",
    "UNPIVOT"."STATUS" "STATUS$1",
    "UNPIVOT"."YEAR_LAID" "YEAR_LAID$1",
    "UNPIVOT"."MATERIAL" "MATERIAL$1",
    "UNPIVOT"."PRESSURE" "PRESSURE$1",
    "UNPIVOT"."DIAMETER" "DIAMETER$1",
    "UNPIVOT"."METHODLAID" "METHODLAID$1",
    "UNPIVOT"."JOINTTYPE" "JOINTTYPE$1",
    "UNPIVOT"."SDR" "SDR$1",
    "UNPIVOT"."LENGTHLAID" "LENGTHLAID$1",
    "UNPIVOT"."LENGTHDIGITESED" "LENGTHDIGITESED$1",
    "UNPIVOT"."MESUREUNIT" "MESUREUNIT$1"
    FROM (SELECT
    "ASSETNUM" "ASSETNUM",
    "SITEID" "SITEID",
    "STATUS" "STATUS",
    "YEAR_LAID" "YEAR_LAID",
    "CLASSIFICATIONID" "CLASSIFICATIONID",
    MIN(CASE WHEN "ASSETATTRID" = 'MATERIAL' THEN "ALNVALUE" ELSE NULL END) "MATERIAL",
    MIN(CASE WHEN "ASSETATTRID" = 'PRESSUREREGIME' THEN "ALNVALUE" ELSE NULL END) "PRESSURE",
    MIN(CASE WHEN "ASSETATTRID" = 'DIAMETER' THEN "NUMVALUE" ELSE NULL END) "DIAMETER",
    MIN(CASE WHEN "ASSETATTRID" = 'METHODLAID' THEN "ALNVALUE" ELSE NULL END) "METHODLAID",
    MIN(CASE WHEN "ASSETATTRID" = 'JOINTTYPE' THEN "ALNVALUE" ELSE NULL END) "JOINTTYPE",
    MIN(CASE WHEN "ASSETATTRID" = 'SDR' THEN "ALNVALUE" ELSE NULL END) "SDR",
    MIN(CASE WHEN "ASSETATTRID" = 'LENGTHLAID' THEN "NUMVALUE" ELSE NULL END) "LENGTHLAID",
    MIN(CASE WHEN "ASSETATTRID" = 'LENGTHDIGITISED' THEN "NUMVALUE" ELSE NULL END) "LENGTHDIGITESED",
    MIN(CASE WHEN "ASSETATTRID" = 'DIAMETER' THEN "MEASUREUNITID" ELSE NULL END) "MESUREUNIT"
    FROM (SELECT
    "MV_PIPE"."ASSETNUM" "ASSETNUM",
    "MV_PIPE"."SITEID" "SITEID",
    "MV_PIPE"."STATUS" "STATUS",
    "MV_PIPE"."YEAR_LAID" "YEAR_LAID",
    "MV_PIPE_SPEC"."ASSETATTRID" "ASSETATTRID",
    "MV_PIPE_SPEC"."NUMVALUE" "NUMVALUE",
    "MV_PIPE_SPEC"."ALNVALUE" "ALNVALUE",
    "MV_PIPE_SPEC"."MEASUREUNITID" "MEASUREUNITID",
    "MV_PIPE"."CLASSIFICATIONID" "CLASSIFICATIONID"
    FROM "MV_PIPE_SYN" "MV_PIPE",
    "MV_PIPE_SPEC_SYN" "MV_PIPE_SPEC" WHERE "MV_PIPE"."ASSETNUM" in ('466651706','606703143') and ( "MV_PIPE"."ASSETNUM" = "MV_PIPE_SPEC"."ASSETNUM" )) "OUTGRP1"
    GROUP BY
    "ASSETNUM", "SITEID", "STATUS", "YEAR_LAID", "CLASSIFICATIONID") "UNPIVOT"

  • How to use LIKE operator in plsql

    Hi
    I wanted to select certain rows using like operator in plsql(Input should be given by the user). I have given my experiment here .I couldn't get any result.
    As per sql syntax while using LIKE operator we should give search criteria within single quote.where as in plsql if we give within single quote its takes as string so no output is comming.what is solution ? How to use like operator in plsql?
    sql syntax
    SQL>SELECT customer_name FROM customer_header
    WHERE customer_name LIKE 'B%' ; customer_name
    Bala murali
    Babu
    Basker
    plsql syntax
    PROCEDURE pro_custheader_like ( v_cname IN varchar2
         ,answer OUT type_refcur_customer) IS
         BEGIN
         OPEN answer FOR
         SELECT customer_name FROM customer_header
              WHERE customer_name LIKE ( ' v_cname ' );
    END pro_custheader_like;
    execution command
    sql>variable answer refcursor;
    sql>set serveroutput on
    sql>exec package_name.pro_custheader_like( 'R',:answer);
    plsql successfully completed
    sql>print :answer
    no row selected
    by
    balamuralikrishnan.s

    plsql syntax
    PROCEDURE pro_custheader_like ( v_cname IN
    varchar2
    ,answer OUT
    type_refcur_customer) IS
    N
         OPEN answer FOR
         SELECT customer_name FROM customer_header
    WHERE customer_name LIKE ( v_cname );
    END pro_custheader_like;
    Try it without any quotes. And, let us know your feedback.
    Regards.
    Satyaki De.
    Message was edited by:
    Satyaki_De

Maybe you are looking for

  • How can I display an Internal from a frame

    Hello, I have a frame application, inside the frame I have a jtable. when the users double click on a row from the table. I want to display an internalJFrame, which contain a tree with data on it. I try different combination with no luck. Below is th

  • Nerving Problem with UTF-8 and ISO-8859-1

    Hi, I´m looking for a solution to serve this problem for many hours now, maybe someone can help me: 1.) We need to send our Mails with the ISO-8859-1-Charset because otherwise Windows-Users get the text in the message twice: once as plain, and after

  • Sequential Instantiation of BPEL instances for a BPEL process

    Hi, We are using Oracle SOA 10.1.3.4 & AIA2.5. We have a situation where the instances of a particular bpel process have to be executed in sequence. Also, the new instance should NOT be instantiated unless the previous instance is completed. For exam

  • Drill down format in Ke30 report

    Hello, In Ke30 Copa report after executing the report, the output comes as per attached format,(Pls check file attached for reference)... I have created the form in ke35 in below format, Sales              xxxx Cogs              xxxx GM              

  • Linking the views

    Hi, i am facing a problem while linking two views in the bsp application (under the same controller). i am using the anchor tag <a> for the hyper reference, because i have to link the views through hyper reference only, can anyone please tell me the