Need of a query to retrieve the data

Hello

I have a table named person. It has two fields A_ID and B_ID. The table does not have a primary key
The data in the table are the following

A_ID B_ID_ _

1 5
1 10
2 5
2 10
4 15
5 20

I need to select A_ID and B_ID data so that when you select a given allocation A_ID or B_ID is not for more choices

For Eg: I select the first pair of 1 and 5. Then 1 and 5 is not in the selection of data from A_ID or B_ID

The output of the query for the data in the table above should be

Output

A_ID B_ID_ _

1 5
2 10
4 15

Hope you understand the situation.
Can someone help me to create a query for me

Thanks in advance

Published by: user599079 on August 12, 2009 21:40

This done:

Nope:

SQL>  with t as (
 select 1 a_id, 5 b_id from dual union all
 select 1, 10 from dual union all
 select 2, 5 from dual union all
 select 2, 10 from dual union all
 select 4, 15 from dual union all
 select 5, 6 from dual union all
 select 6, 9 from dual
),
union_data  as
(
    select    a_id    as id
    ,    'A'    as col
    ,    row_number () over (order by a_id, b_id)    as r_num
    from   t
union all
    select    b_id    as id
    ,    'B'    as col
    ,    row_number () over (order by a_id, b_id)    as r_num
    from    t
)
,    grouped_data    as
(
    select      id
    ,      min (col) keep (dense_rank first order by r_num)    as first_col
    ,      min (r_num)                                     as first_r_num
    ,      row_number () over ( partition by min (col) keep (dense_rank first order by r_num)
                              order by        min (r_num)
                     )                    as out_num
    from      union_data
    group by  id
)
select      a.id    as a_id
,      b.id    as b_id
from      grouped_data    a
join      grouped_data    b    on    a.out_num    = b.out_num
where      a.first_col    = 'A'
and      b.first_col    = 'B'
order by  a.out_num
/
      A_ID       B_ID
---------- ----------
         1          5
         2         10
         4         15

3 rows selected.

I expect him back at the last row too much (like my request).
In addition to change line 5 - 6 5-25 mess up completely:

      A_ID       B_ID
---------- ----------
         1          5
         2         10
         4         15
         6         25

Tags: Database

Similar Questions

  • Query to retrieve the data in a sort of pivot format.

    Hello gurus of PL/SQL,.
    I need to extract the data in a format some tables using the join condition. When I extracted using simple join then it turn around individual records based on condition, but want it in a particular format only.

    When run the query-

    Select sf. JOIN_DT_KEY, sd. CLS, sd. CLS_STATUS, sf. CLS_QTY, sf. CLS_FEES,
    SF. TOTAL_AMT
    of stud_det_fact sf, sd, cd class_dim stud_tag_dim
    where sf.stud_dim_key = sd.stud_dim_key
    AND sf.alloc_cls_dim_key = d.alloc_cls_dim_key AND sd. CLS_STATUS IN
    ("BA", "BSC", "MA", "MBA", "SMC")
    AND af. JOIN_DT_KEY between 20120404 and 20120410 ORDER BY sd. CLS

    That the data is returned in the following format:

    JOIN_DT_KEY CC CLS_STATUS CLS_QTY CLS_FEES TOTAL_AMT
    1 20120404 BA 1050000 12 875 WORK
    2 20120404 BA 125 12 150000 CAPITAL
    3 20120404 BA 1050000 12 875 WORK
    4 20120404 BSC 4 10 4000 CAPITAL
    5 20120404 BSC 3 10 3000 CAPITAL
    6 20120404 MY 1050000 12 875 WORK
    7 20120404 MY 1000 12 1200000 WORK
    8 20120404 MBA 1200000 12 1000 ALGO
    9 20120404 MBA 1200000 12 1000 ALGO

    But I want to in the format after using query itself.

    JOIN_DT_KEY WORK of CLS (Qty) WORK (Amt) CAPITAL (Qty) CAPITAL (Amt) (Qty) ALGO ALGO (Amt) NATURAL (Qty) NATURAL (Amt) GrandTotal (Qty) GrandTotal (Amt)
    20120404 1750 2100000 125 150000 0 0 0 0 1875 2250000 BA
    0 0 7 7000 BSC 0 0 0
    0 7 7000
    MY 1875 2250000 0 0 0 0 0
    0 1875 2250000
    0 0 0 0 2000 2400000 MBA 0
    2400000 2000 0
    3625 total 4350000 132 157000 2000 2400000 0
    0 6907000 of 5757

    How to change the query to get the hinge of the sort of result, kindly help me. I appreciate all your help in advance.

    Thank you and I really apperciate your help.

    Note:-attached, this is the example of excel sheet.

    Published by: user555994 on April 26, 2012 03:43

    I suggest that to take advantage of the Oracle version you have.

    To start, I took your first message and created a few sample data. This is not your original tables, but it allows us to compare the results.

    drop table T;
    create table T(JOIN_DT_KEY, CLS, STATUS, QTY, FEES, AMT) as select
    TO_DATE('20120404', 'YYYYMMDD'), 'BA', 'WORKING', 875, 12, 1050000 from dual union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'BA', 'CAPITAL', 125, 12, 150000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'BA', 'WORKING', 875, 12, 1050000 from dual union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'BSC', 'CAPITAL', 4, 10, 4000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'BSC', 'CAPITAL', 3, 10, 3000 from dual union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'MA', 'WORKING', 875, 12, 1050000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'MA', 'WORKING', 1000, 12, 1200000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'MBA', 'ALGO', 1000, 12, 1200000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'MBA', 'ALGO', 1000, 12, 1200000 from DUAL;
    

    To test the following against your data, is taken your SELECT in the right place or create a view and plug the display where I have the table "T".

    Now, here's how to get everything except the last line "Total":

    select *
    from (
      select JOIN_DT_KEY, CLS, STATUS, QTY, AMT from t
    )
    PIVOT(SUM(QTY) QTY, SUM(AMT) AMT
    for STATUS in('ALGO' as ALGO,'CAPITAL' as CAPITAL,'DMA' as DMA,'NATURAL' as natural,'WORKING' as WORKING));
    
    JOIN_DT_KEY        CLS ALGO_QTY ALGO_AMT CAPITAL_QTY CAPITAL_AMT DMA_QTY DMA_AMT NATURAL_QTY NATURAL_AMT WORKING_QTY WORKING_AMT
    ------------------ --- -------- -------- ----------- ----------- ------- ------- ----------- ----------- ----------- -----------
    2012/04/04 00:00   BSC                             7        7000
    2012/04/04 00:00   BA                            125      150000                                                1750     2100000
    2012/04/04 00:00   MBA     2000  2400000
    2012/04/04 00:00   MA                                                                                           1875     2250000
    

    To get the latest "Total" line, you need to do another GROUP after the pivot.

    select JOIN_DT_KEY, nvl(CLS, 'Total') cls,
    SUM(ALGO_QTY) ALGO_QTY,
    SUM(ALGO_AMT) ALGO_AMT,
    SUM(CAPITAL_QTY) CAPITAL_QTY,
    SUM(CAPITAL_AMT) CAPITAL_AMT,
    SUM(DMA_QTY) DMA_QTY,
    SUM(DMA_AMT) DMA_AMT,
    SUM(NATURAL_QTY) NATURAL_QTY,
    SUM(NATURAL_AMT) NATURAL_AMT,
    SUM(WORKING_QTY) WORKING_QTY,
    SUM(working_AMT) working_AMT
    from (
      select JOIN_DT_KEY, CLS, STATUS, QTY, AMT from t
    )
    PIVOT(SUM(QTY) QTY, SUM(AMT) AMT
    for STATUS in('ALGO' as ALGO,'CAPITAL' as CAPITAL,'DMA' as DMA,'NATURAL' as natural,'WORKING' as WORKING))
    group by grouping sets((join_dt_key, cls), join_dt_key);
    
    JOIN_DT_KEY        CLS   ALGO_QTY ALGO_AMT CAPITAL_QTY CAPITAL_AMT DMA_QTY DMA_AMT NATURAL_QTY NATURAL_AMT WORKING_QTY WORKING_AMT
    ------------------ ----- -------- -------- ----------- ----------- ------- ------- ----------- ----------- ----------- -----------
    2012/04/04 00:00   BA                              125      150000                                                1750     2100000
    2012/04/04 00:00   MA                                                                                             1875     2250000
    2012/04/04 00:00   BSC                               7        7000
    2012/04/04 00:00   MBA       2000  2400000
    2012/04/04 00:00   Total     2000  2400000         132      157000                                                3625     4350000
    

    Using "grouping sets", you group by join_dt_key and cls (which the PIVOT is already done, but you have to do it again) and then by join_dt_key to get the total line.

    Note: I suppose you want a total by date. If you want just a total general for all dates, then Group Rollup (join_dt_key, cls)).

    I hope it's accurate and useful.

  • Query to retrieve the data according to requirement

    Hi team,

    I have the table with the details below and my requirement is when I entered the correct empid then only need to display recording (it's easy) and when I entered the empid that is not listed in the table, then I need to display all the records available in this table. Please give me the query.

    EmpID ename

    7839KING
    7698BLAKE
    7782CLARK
    7566JONES
    7788SCOTT
    7902FORD
    7369SMITH

    Kind regards

    Anil

    can you please mark it as answered@user575819

  • Cannot retrieve the data by binary storage by default for XML 11 g

    Oracle 11.2

    All,

    As someone mentioned in another post, I got I should use binary XMLType CLOB rather than 11g because it is more efficient. When I create the XMLType column as binary I can't retrieve the value of the column, but when I use CLOB I am able to extract data on.

    -Create table with XMLTYPE column.  Since it is 11.2 storage of the column is automatically binary
    CREATE THE TABLE HR. XMLTABLESTORE (key_id VARCHAR2 (10) PRIMARY KEY, xmlloaddate date, xml_column XMLTYPE);

    -Insert the XML into the XML column
    INSERT INTO HUMAN RESOURCES. VALUES XMLTABLESTORE (HR. XMLSEQUENCE. NEXTVAL, SYSDATE, XMLType (bfilename ('XMLDIRX', 'PROD_20110725_211550427_220b.xml'),
    nls_charset_id ('AL32UTF8'))); COMMIT;

    -When I do a select I see full XML in the xml_column column
    SELECT * FROM HR. XMLTABLESTORE

    -When I run the following query I get the following:
    SELECT extract (xml_column, ' / / MapItem/@ProductNum') ProductNum OF HR. XMLTABLESTORE

    ProductNum
    -------------
    XMLType

    -When I run the following query on the @, I get the following:
    SELECT extract (xml_column, ' / / MapItem/ProductNum ') ProductNum OF HR. XMLTABLESTORE

    ProductNum
    -------------
    Null value

    When I run the same SELECT query retrieves (xml_column, ' / / MapItem/@ProductNum') ProductNum OF HR. XMLTABLESTORE and the table is created by CLOB, I get out the expected value of the XML file.

    How can I get the query to retrieve the data through a binary file?

    I appreciate any help in advance.

    Thank you
    Shawn

    Published by: 886184 on Sep 20, 2011 15:42

    Probably a problem with your client tool.

    It works for me:

    SQL*Plus: Release 11.2.0.2.0 Beta on Mer. Sept. 21 19:39:55 2011
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Beta
    
    SQL> CREATE TABLE xmltablestore (
      2    key_id VARCHAR2(10) PRIMARY KEY
      3  , xmlloaddate DATE
      4  , xml_column XMLTYPE
      5  );
    
    Table created.
    
    SQL> INSERT INTO xmltablestore
      2  VALUES ('1', sysdate, XMLType(bfilename('TEST_DIR', 'PROD_20110725_211550427_220b.xml'),nls_charset_id('AL32UTF8')))
      3  ;
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> SELECT extract(xml_column, '//MapItem/@ProductNum') ProductNum
      2  FROM xmltablestore
      3  ;
    
    PRODUCTNUM
    --------------------------------------------------------------------------------
    63481062975
    
    SQL> SELECT extractValue(xml_column, '//MapItem/@ProductNum') ProductNum
      2  FROM xmltablestore
      3  ;
    
    PRODUCTNUM
    --------------------------------------------------------------------------------
    63481062975
    
    SQL> SELECT xmlcast(
      2          xmlquery('/Entries/Category/MapItem/@ProductNum'
      3           passing t.xml_column
      4           returning content
      5          )
      6          as number
      7         ) ProductNum
      8  FROM xmltablestore t
      9  ;
    
    PRODUCTNUM
    ----------
    6,3481E+10
    
    SQL> SELECT xmlcast(
      2          xmlquery('/Entries/Category/MapItem/@ProductNum'
      3           passing t.xml_column
      4           returning content
      5          )
      6          as varchar2(30)
      7         ) ProductNum
      8  FROM xmltablestore t
      9  ;
    
    PRODUCTNUM
    ------------------------------
    63481062975
    

    BTW, extract and extractvalue functions are deprecated in version 11.2.
    Oracle now recommends using XMLCast/XMLQuery.

  • Need to retrieve the data for the current date.

    Hello

    I have a table which then retrieves information when using this command.

    Select ta_acct, shift, created_on track_alerts;

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Manitoba telecom a 24 March 14 system

    Technicolor A 24 March 14

    I used this statement to retrieve the data for the given date.

    Select ta_acct, shift, created_on track_alerts where created_on = 24 March 14 ';

    Its not data recovery.

    Need help.

    Kind regards

    Prasad K T,.

    984002170

    Prasad K T wrote:

    Yes the created data type is date.

    CREATED_ON DATE

    Partha thanks it works now.

    Select ta_acct, shift, created_on in track_alerts where to move is: Shift and TRUNC (created_on) = TO_DATE('24-MAR-2014','DD-MON-YYYY');

    Still, I made a small change to my querry.

    Select ta_acct, shift, created_on track_alerts where to move is: shft and TRUNC (created_on) = TO_DATE (select double sysdate,'MON-DD-YYYY "");

    For this statement, it does not work.

    of course not...

    first: sysdate returns a date so no need of conversion here

    and

    second SYSDATE includes time, so your application should look like this:

    Select ta_acct, shift, created_on in track_alerts where to move is: Shift and TRUNC (created_on) = trunc (sysdate)

    or

    Select ta_acct, shift, created_on in track_alerts where to move is: shft and created_on > = trunc (sysdate) and created_on<>

    HTH

  • SQL query to represent the data in the graph bar

    Hello

    JDev 11.1.1.5.0

    We must create a dashboard to track the translation. We have created the ADF table with buttons 'Create', 'Update' and 'Delete' to manipulate the table.

    Our DB table structure is

    File_id (PK), File_Name, ToSpanish - ARE (YES/NO), beginning of the ToSpanish, ToChina(YES/No), ToChina-Date... etc.

    Once the translated file required language then user must update the DB table using the button "Update".

    So far, we have implemented the requirement above.

    We need represent the status of the translation in the graph bar with the language as X access and file count get access Ex: Spanish-100 China - 200 files files

    Please suggest the sql query to retrieve the necessary info from the DB table that can be represented in the graph bar. Also, it would be great, if you can provide a pointers to create a bar chart.

    Thanks in advance,

    MSR.

    If you set your major increment and minor than 1, then you won't not show decimal points.  You can try setting these 10 or 100 to reach your goal.

    Subtype = "BAR_VERT_CLUST" >

                 

  • Query to retrieve the number of transactions in every 1 hour for the end

    Hello

    Could someone help to write a query to retrieve the number of transactions in every hour for the last month.

    Case:
    I / P

    If Timestamp1
    1 01/01/2008 00:00:01
    CAS2 01/01/2008 00:01:01
    case3 01/01/2008 01:00:01
    1 01/01/2008 01:02:01
    case4 01/01/2008 01:10:01
    Service5 01/02/2008 02:00:01
    Case6 01/02/2008 02:10:01
    case7 2008-02-01 23:00:01
    .............................

    .............................
    case... 2008-01-31 00:24:00


    O/P
    cases of to_time of time
    2008-01-01 00:00:00 01/01/2008 01:00 2
    2008-01-01 01:00:01 01/01/2008 02:00 3

    .........................
    .........................

    etc.

    Any help really appreciated

    We can do this by using analytic functions

    Here's what I did:

    create table timestamp1 (date of ts)

    Select * from timestamp1
    2008-10-30 15:41:13
    2008-10-30 15:41:05
    2008-10-30 15:40:03
    2008-10-30 14:58:26
    2008-10-30 14:29:45
    2008-10-30 13:17:48
    2008-10-30 08:29:50
    2008-10-30 06:05:51
    2008-10-30 03:41:52
    2008-10-30 02:29:54

    Select distinct to_char (ts, 'hh24') frmhrs,
    TO_CHAR (ts, 'hh24') + 1 tohrs, count (ts) OVER (order by to_number (to_char (ts, 'hh24')) RANK BEFORE (1/24))
    of timestamp1
    When trunc (ts) = trunc (sysdate) - I added this just to make sure that I get for data of today
    order of frmhrs

    FRMHRS TOHRS CNT
    1-3-02
    03-4-1
    06 7 1
    1-9-08
    13 14 1
    14 15 2
    15 16 3

    You can customizeas by your need.

  • How to join two tables to retrieve the data from the columns in table two. Tables have primary and foreign key relationships

    Hello

    I want to join the two tables to retrieve the data from the columns of the two table passing parameters to the join query. Tables have primary and foreign key relationships

    Details of the table

    Alert-1 - AlertCode (FK), AlerID (PK)

    2 AlertCode-AlertDefinition-(PK)

    Help, please


    ----------

    Hi Vincent,.

    I think that you have not worked on adf 12.1.3.  In adf 12.1.3 you don't have to explicitly create the association. When you create the EO to your table, Association xxxxFkAssoc, will be created by ADF12.1.3 for you automatically. Please try this and do not answer anything... You can also follow the links below. I solved the problem by using the following link

    Oracle ADF Guide step by step - Oracle ADF tutorial: creating a relationship of the master / detail using Oracle ADF

    ---

  • Need a sql query to get several dates in rows

    Hi all

    I need a query to get the dates of the last 7 days and each dates must be in a line...

    but select sysdate double... gives a line...

    Output of expexcted

    Dates:

    October 1, 2013

    30 sep-2013

    29 sep-2013

    28 sep-2013

    27 sep-2013

    26 sep-2013

    Try:

    SQL > SELECT sysdate-7 + LEVEL FROM DUAL

    2. CONNECT BY LEVEL<=>

    3 * ORDER BY 1 DESC

    SQL > /.

    SYSDATE-LEVEL 7 +.

    -----------------------------

    October 1, 2013 13:04:52

    30 - Sep - 2013 13:04:52

    29 - Sep - 2013 13:04:52

    28 - Sep - 2013 13:04:52

    27 - Sep - 2013 13:04:52

    26 - Sep - 2013 13:04:52

    25 - Sep - 2013 13:04:52

    7 selected lines.

  • Query to retrieve the level 2 supervisors

    Hi all

    I use the following query to retrieve the people which is under the supervision of a given person_id... Is it possible to modify this query (see below) in order to get two levels of employees? something like:

    Supervisor 1
    Employee 1
    Employee 2
    Employee 3
    Supervisor 2
    Employee 4
    Employee 5
    Employee 6

    The query works if I pass the person_id 1 for example supervisor that I would get used 1 2 and 3. But if I pass an id of the person who, of higher hierarchy, I will just get supervisor 1 supervisor 2... And I need all the people (just two levels down)

    Select distinct *)
    Select distinct ppf.first_name |' '|| PPF.last_name
    ppf.last_name
    fu.user_name
    fu.user_id
    ppf.person_id
    papf.person_id Manager
    pi.image_id
    initcap (hla.description) LOCATION
    pb.NAME pay_basis_name
    pax.grade_id
    haou.name
    employment_category
    ppos.date_start
    of per_assignments_x pax
    per_grade_definitions pgd
    per_people_x WP
    fnd_user fu
    per_all_people_f women's wear
    per_images pi
    hr_locations_all hla
    per_pay_bases pb
    hr_all_organization_units haou
    per_periods_of_service OPP
    where ppf.person_id = pax.person_id
    and trunc (sysdate) between papf.effective_start_date and papf.effective_end_date
    and fu.person_party_id = papf.party_id
    and pax.supervisor_id = papf.person_id
    and pi.parent_id (+) = ppf.person_id
    and pi.table_name (+) = "PER_PEOPLE_F".
    and pax.person_id = ppf.person_id
    and hla.location_id (+) = pax.location_id
    AND ppf.current_employee_flag = 'Y '.
    AND pb.pay_basis_id = pax.pay_basis_id
    AND haou.organization_id = pax.organization_id
    AND ppos.person_id = ppf.person_id
    AND pax.grade_id = pgd.grade_definition_id
    AND papf.person_id =: inPersonId
    UNION ALL
    Select ppf.first_name |' '|| PPF.last_name
    ppf.last_name
    fu.user_name
    fu.user_id
    ppf.person_id
    papf.person_id Manager
    pi.image_id
    initcap (hla.description) LOCATION
    pb.NAME pay_basis_name
    pax.grade_id
    haou.name
    employment_category
    ppos.date_start
    of per_people_x WP
    per_grade_definitions pgd
    fnd_user fu
    per_all_people_f women's wear
    HR_WORKING_PERSON_LISTS HWPL
    per_images pi
    per_assignments_x pax
    hr_locations_all hla
    per_pay_bases pb
    hr_all_organization_units haou
    per_periods_of_service OPP
    where
    trunc (sysdate) between papf.effective_start_date and papf.effective_end_date
    and fu.person_party_id = papf.party_id
    AND HWPL.owning_person_id = papf.person_id
    and hwpl.selected_person_id = ppf.person_id
    AND pi.parent_id (+) = ppf.person_id
    and ppf.current_employee_flag = 'Y '.
    and pax.person_id = ppf.person_id
    AND hla.location_id (+) = pax.location_id
    AND pb.pay_basis_id = pax.pay_basis_id
    AND haou.organization_id = pax.organization_id
    AND ppos.person_id = ppf.person_id
    AND pax.grade_id = pgd.grade_definition_id
    AND papf.person_id =: inPersonId
    ) order of last_name

    Hello Alejandro,

    You can play a little bit with one below with what you find most comfortable.

    / * multi level * /.
    Select the level
    assignment_number
    assignment_id
    Manager
    , (select full_name from per_people_x where person_id = pax.person_id)
    , sys_connect_by_path ((sélectionnez employee_number dans per_people_x où person_id = pax.person_id), '-->')
    of per_assignments_x pax
    where primary_flag = 'Y '.
    connect by prior person_id = Manager
    Start by person_id = 1523

    / * level 2 only * /.
    Select (select full_name from per_people_x where person_id = pax1.person_id)
    , (select full_name from per_people_x where person_id = pax2.person_id)
    of per_assignments_x pax1
    per_assignments_x pax2
    where pax1.supervisor_id = 1523
    and pax1.primary_flag = 'Y '.
    and pax1.person_id = pax2.supervisor_id
    and pax2.primary_flag = 'Y '.

  • How to write a simple select query to get the data of the table as an XML.

    How to write a simple select query to get the data of the table as an XML. In the query, I'm just adding items below which i need be there in the XML document
    select '<test_tag>'||EMP_NAME||'</test_tag>','<date>'||sysdate||'</date>' 
    from temp_table where id_num BETWEEN 1 AND 10;
    I have need to add the root tag as well in the beginning and the end of < root > < / root > this xml file. Please advice if this is possible with the select query
    without using XMLGEN, XMLQUERY or any other packages built and function?

    I need to URL escapes with the UTF-8 code points that we have already achieved using the utl_http package. Please help how to do that without using the utl_http package.

    What is wrong with him?

    At present, the only way I can think of to avoid a call to UTL_HTTP. SET_BODY_CHARSET is to write your own little wrapper.
    In this way, you can specify the Boolean parameter or omit it if you choose to use named parameters:

    SQL> create or replace function my_url_escape (url in varchar2)
      2  return varchar2
      3  deterministic
      4  is
      5  begin
      6   return utl_url.escape(url, false, 'AL32UTF8');
      7  end;
      8  /
    
    Function created
    
    SQL> select my_url_escape('http://some.uri.com/param?lang=fr&text=contrôle') from dual;
    
    MY_URL_ESCAPE('HTTP://SOME.URI
    --------------------------------------------------------------------------------
    http://some.uri.com/param?lang=fr&text=contr%C3%B4le
     
    
  • Query to retrieve the latest version

    Hello
    I am trying to create a query that retrieves the latetst of a product version. There are 2 tables I have mark from, we have the product number and we got the version - a varchar2 data type (60). Are versions A, B, c... etc. So, I want to give me a line for each product with its latest version of the application. It's the query I have so far


    SELECT A0. Prod_num, A0.version
    FROM (SELECT A0B. Prod_num, A0.version
    Of tb_1 A0, tb_2 A0B
    WHERE (A0.tb_1pk = A0B.tb_2pk)) A0
    ranking by A0. Prod_num

    Returns duplicate versions and product lines.

    Thank you.

    Without seeing sample data...

    SELECT A0B. Prod_num,
    Max (a0.version)
    Of tb_1 A0, tb_2 A0B
    WHERE (A0.tb_1pk = A0B.tb_2pk)
    AO8.prod_num GROUP;

  • BlackBerry Z3, I lost all my data on my SD storage card, please help me to retrieve the data.

    Dear Sir.

    I lost all my data on my SD storage card, please help me to retrieve the data. I have a Z3, just bought only a week before, I removed the card with the phone off and then give the card again and noticed that I lost all the data. Please help

    Try restarting your phone. Sometimes it shows data that brought them "disappeared". To do this, hold down your power button for about 15 seconds, until you see BlackBerry on your screen. Do not release the button until you see that without taking account of any other thing you see before that.

    Try this and post back with your results.

  • ORA-01124: cannot retrieve the data file 1 - file is in use or recovery

    I'm trying to recover the database in waiting, but it gives the error below.

    ORA-00283: cool cancelled due to errors
    ORA-01124: cannot retrieve the data file 1 - file is in use or recovery, the recovery is already said
    ORA-01110: data file 1: ' I:\ORACLE\QAS\SAPDATA1\SYSTEM_1\SYSTEM. DATA1'

    When I checked in the alert log recovery is not started. and later I hae given ' alter database recover Cancel "and the command to meet with the threshold.

    "media recovery has not started.

    It seems that the recovery was stuck between the two.
    Please advise me how to kill the recovery session that is stuck. because I don't want to bounce the database pending.

    Thanks in advance.

    Dataguard and MRP, you run a script before.

    In a standby scripted, a session to RETRIEVE the DATABASE would an UNTIL clause (SEQUENCE up to THAT most likely). At the end of the recovery at this point (SEQUENCE #), he left and stop at the database.

    In addition, the script is such that when a RECOVERY session is active, another session is not authorized to start. It can loop in pending state or go out and do it again the next scheduled interval.

    Apparently your startup script is not strong enough to prevent another session of RECOVERY to start even though the first is active (or it doesn't have a good up to THAT clause and stop, exit, closing stocks)

    What you have is a custom implementation of a database of pending. Without all the details of the script, the 'blocking' between sessions (to avoid a second RECOVER start when one is already running) etc... We can't really do much to help you.
    Your scripts must be standing with status information. It should be possible for you to discover the 'other' sqlplus session which emanates a DATABASE to RECOVER, but not yet out (p. ex... How about a simple "ps - ef |") grep sql' and ' ps - ef | combination of grep ora"?)

    Hemant K Collette

    Published by: Hemant K Collette on May 29, 2013 17:47

  • ADFDI-05577: could not retrieve the data table on the server.

    Dear all,

    My use case is, when I opened my excellent work book, I have this error message is out ' ADFDI-05577: could not retrieve the data table on the server line "and when I click on the button 'OK' of the error message I can recover all the data on the server. Please help me how to solve this error?


    Concerning
    KT

    Thanks much Sireesha Pinninti, John Stegeman, Arun.

    Yes, my problem is of subquery. I found a solution from this site.
    http://www.DBA-Oracle.com/t_ora_01427_single_row_subquery_returns_more_than_one_row.htm,
    http://srinisboulevard.blogspot.com/2010/04/ora-01427-single-row-subquery-returns.html
    http://StackOverflow.com/questions/3804850/erroneous-ora-01427-single-row-subquery-returns-more-than-one-row / / the answer is the last line

    Before change (error subquery)

    CheckingEO.BO,
    (SELECT ntr_no FROM test
    WHERE cs_no = CheckingEO.CS_NO) NTR_NO
    To archive the CheckingEO

    Edit it like this

    (SELECT ntr_no FROM test
    WHERE cs_no = CheckingEO.CS_NO and Rownum = 1) NTR_NO
    To archive the CheckingEO

    Concerning
    KT

    Published by: KT on 23 May 2012 15:35

    Published by: KT on 23 May 2012 15:48

Maybe you are looking for