Lead a recovery corresponding ID column delimited values

I use version 11.2.0.4 of Oracle Enterprise Edition.

I have the rest of table and I wrote as a result of function to fetch the params_id of params_desc.  His good work for a unique description in a column to help (SELECT get_PARAMS_ID ("ELECTRICAL FAULT") FROM DUAL;).  But in my first article, I have two descriptions in params_desc area separated by a vertical bar (|).  So eitheer I send 'MEDIA RECOVERY REQUIRED' OR 'RECOVERY OF SYSTEM REQUIRED' in the service, I should get my params_id = 1.  How can I change my function to get it?

I don't want to use as the operator e.g.WHERE PARAMS. PARAMS_DESC like '% P_PARAMS_DESC %', because there may be a lot many matching works in the params_desc field.

Please advice.

Thank you

CREATE ARRAY PARAMS

(PARAMS_ID NUMBER NOT NULL,

PARAMS_DESC VARCHAR2 (50) NOT NULL

)

/

insert into params values (1,'MEDIA RECOVERY REQUIRED |) REQUIRED SYSTEM RECOVERY ");"

insert into values (2, "BREAKDOWN ELECTRIC") params;

insert into values params (3, 'VALUE');

COMMIT;

COMMIT;

-I wrote it as a result of function to fetch the params_id of params_desc.

create or replace

FUNCTION get_PARAMS_ID

(p_PARAMS_DESC IN PARAMS. PARAMS_DESC % TYPE)

RETURN PARAMS. TYPE % PARAMS_ID

AS

v_PARAMS_ID PARAMS. TYPE % PARAMS_ID;

BEGIN

SELECT PARAMS. PARAMS_ID

IN v_PARAMS_ID

OF PARAMS

WHERE PARAMS. PARAMS_DESC = P_PARAMS_DESC;

RETURN v_PARAMS_ID;

END get_PARAMS_ID;

/

SELECT get_PARAMS_ID ("ELECTRICAL FAULT") FROM DUAL;

Assuming that P_PARAMS_DESC does not contain percent signs and underscores:

SELECT PARAMS. PARAMS_ID

IN v_PARAMS_ID

OF PARAMS

OÙ ' |' || PARAMS. PARAMS_DESC | '|' LIKE ' % |' | P_PARAMS_DESC | '|%';

SY.

Tags: Database

Similar Questions

  • A statement UPDATE changes the line if the update changes the column even value?

    HI -.

    I have a main classification and the corresponding audit table. I have a trigger. I created using the suggestion:http://www.runningoracle.com/product_info.php?products_id=211

    Now the problem that I am facing is that: if I run the same query (same value) update on the main table for n times (with the same data)... my audit table is updated with a new record every time. He is not able to determine that the value is the same.

    My goal is to load the audit table data if the value in a cell in the main table is really have changed.

    A statement UPDATE changes the line if the update changes the column even value?

    Best regards

    I have a main Table and the corresponding Audit Table. I have a trigger. I created using the suggestion:http://www.runningoracle.com/product_info.php?products_id=211

    Why?

    You try to resolve what made you what are the PROBLEM that select as the solution?

    Now the problem that I am facing is that: if I run the same query (same value) update on the main table for n times (with the same data)... my audit table is updated with a new record every time.

    Yes - it is EXACTLY what you say that you wanted to do and EXACTLY what the code does in this article.

    He is not able to determine that the value is the same.

    I think you mean that the code does NOT check if the value is the same. You can certainly change the code to do this check. But I have a question to start with your need for such a solution.

    My goal is to load the audit table data if the value in a cell in the main table is really have changed.

    OK - then modify the code to check EACH COLUMN and compare its NEW value to the OLD value and insert only the table of audit if SOME (or columns you care specifically) have changed.

    A statement UPDATE changes the line if the update changes the column even value?

    It depends on what you mean by 'change the line '. Of course to update a column with the SAME value does not change the resulting data value.

    But the physical structure of the line, the location of the pieces of line and information in the header block (YVERT, etc.) will change. And, as others have said Oracle doesn't know and doesn't care, so if the new value of a column is the same as the old value will create redo, undo and the rest.

    Start over and tell us what PROBLEM you're trying to solve. Then we can help you find the best way to solve it.

  • Question about pipe delimited values

    Hi all

    Is there any function in Oracle to separate the pipe delimited values? (ex:-ABC |) DEF | IGS)

    I have data in a table as follows:

    table sampletable
    (
    name varchar2 (10),
    place varchar2 (10),
    VARCHAR2 (50) data.
    Description varchar2 (100),
    Remarks varchar2 (100)
    )


    Data place name Description remarks
    ------- ------- ------- -------------- -----------
    John SD AB | BC | OF desc1 no
    Jim ND X | Y desc2 no
    CA Mike data1 desc3 no
    Barry MA data2 desc4 no

    Now I need to retrieve each row of the table, and if the 'Data' column contains the values of pipe delimited, I insert info into a new line. Finally, the data for the table above should be in the form:

    Data place name Description remarks
    ------- ------- ------- -------------- -----------
    John SD AB desc1 no
    John SD BC desc1 no
    John desc1 SD no
    Jim ND X desc2 no
    Jim ND Y desc2 no
    CA Mike data1 desc3 no
    Barry MA data2 desc4 no


    Thank you.

    here in the logic that you have provided, data are hardcoded and you pick it double...

    The WITH clause has been used only to simulate you not table, knapen. The WITH clause is heavily used for this on this forum.
    You can omit the WITH clause yourself and use only the SELECT part of the example of knapen.
    Thus, simply use:

    select name, place, regexp_substr(data, '[^|]*',1,no) data, des, remark
      from t,
           (
           select level no
             from dual
          connect by level <= (
                                select max(length(data)-length(replace(data,'|'))+1) len
                                  from t
                              )
           )
     where regexp_substr(data, '[^|]*',1,no) is not null
     order by name, no
    

    and adjust the name of the table and the columns according to your needs...

  • equation of columns of values in the text file, please help

    I applied an equation to the to column values in a text file, thr is two columns; for every 10 values, I should get an output value, so a total of 5 values + 5 values for each of the two columns with values from 50.

    My vi don't wrk properly, the values are not justifiable, and I get only 5 values instead of 10 (5 for each of the 2 columns with 50 values)

    I have attached hv my vi, pls help.

    Of course, find NaN in there.  You are divided by 0.  Tip: The top 10 items are all 0.

  • How to filter a column of values?

    Hello

    I imported a .csv file large journal that contains many different columns and values in DIAdem. One of the columns contains a hexadecimal value field, and I need to filter the column by the last byte of this hexagonal field. For example, one of the values can be "CFFD0F3" and I need to find all the rows that have "F3" as the last byte. I also need all the other columns to filter the same way.

    There seems to be an easy way to do this in DIAdem, and I searched online and via the discussion forums of the means to accomplish it. Whenever I have to search for the word "filter" it always brings me to the FFT or high-pass/low-pass filters. I want just to filter a column like Excel does, but my log file contains about half a million entries, so I can't fully open in Excel.

    I've attached a screenshot of what some of my columns looks like, but for reasons of confidentiality, I can't reach the log file.

    Someone at - it ideas?

    Thank you!

    Hi Ben,

    I cooked up a small nice application for you.  Given that your post clearly stated that you were dealing with millions of data values, I took care to implement this request as efficiently as possible and to include State dialog boxes so that you know what the script is doing at any time and which actions are most of the time, where we try to further optimize your needs.  You must extract the 3 files in the ZIP file attached in the same folder somewhere.  Then you must run the script "ExtractIDGroups Add.VBS" to add the context menu and enter the UserCommands will call the context menu.  We can implement your tiara to always run this VBScript when you start, once you are satisfied with the result.

    You will use the new context menu in the following way.  Load your data file in DIAdem, and then display the channels of data loaded in a table VIEW, like your screenshot posted.  Now select and right click on the channel "Arb ID" (or depending on the channel has the Hex addresses) and choose the new context menu "extract ID groups.  A user dialog box will pop up on the left of your computer screen lists all the listed final 2 Hex characters of suffix in this channel you clicked on.  Select one or more suffixes desired Hex (shift or control for a multiple selection key), and then click the button.  You will then see each of these selections exploded as a new group in your data portal.  You can select several times the "extract I groups" If you decide to go back and add a few ID groups more.

    The application is currently being implemented to sort the raw data in place according to the values of "Hex suffix" and leave it this way - it so that leaving the channel 'Hex suffix' in the raw data group makes more quickly to repeat ID group gross since the same set of data extraction.  It's also the way more efficient to retrieve more than one ID groups, I'm guessing that you want to.  Each snippet ID Group is sorted by the values of the first chain of this group.  So if you want to sort these groups ID extracted by the string 'Abs Time' or "Time Rel", say, you need to drag this tri-canal in the data portal of his start position to the first position in this group of raw data before selecting the menu "Extract group ID".

    Let me know how it works for you,

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • I have a table with a city of the column. Values are 'delhi' and 'hyderabad '.

    I have a table with a city of the column. Values are 'delhi' and 'hyderabad '.

    as

    ID |   City

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

    1     |  Delhi

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

    2     |  Hyderabad

    Now, I have to update Delhi and Hyderabad Hyderabad with Delhi.

    How to do this?

    Hi Indi,

    (1) why do you want what it? Requirements of companies?

    (2) how much these values you want to reverse? Is it only "Delhi" and "Hyderabad", or there is a list, or other logic?

    Update your_table

    Set city = decode (lower (city), 'delhi', 'Hyderabad', 'hyderabad', 'Delhi')

    where lower (city) ('Delhi', 'hyderabad');

    Does that help?

  • utility outlineload error - unrecognized column header value "Base currency"

    Outlineload.cmd/a: < app > U:admin /D:Entity /I:D:\Import\Entity.txt /L:D:\Import\Entity.log /X:D:\Import\Entity.exc

    That's what I see in my folder EXCEPT for the exceptions. However, I can't find anything wrong with the header of column value reference currency in the import of the entity file. Any suggestion greatly appeciated. I read through other messages that talk about the unrecognized header value column, but those that are specific to the column alias or in need of a space after the column, etc, I found nothing on the Base currency.

    The funny thing is that I exported dev and re same file imported to DEV without change, even after that, it's the same error I get. Clearly the application rejects the header value so that it can export the same thing.

    [Mar 29 23:59:32 EDT Apr 2014] Unrecognized column header value "Base currency".

    [Mar 29 23:59:32 EDT Apr 2014] Impossible to get analytical information and/or perform a data load: values of unrecognized column header, refer to previous messages. (Note: column header values are case sensitive.)

    [Mar 29 23:59:32 EDT Apr 2014] Planning of vector data store loaded with exceptions processes: records not all input have been read errors (or empty input file). 0 records were read, 0 data records have been processed, 0 were accepted for loading (check the actual load with Essbase logs), 0 were rejected.

    Hello

    you have a request for currency?

    If this is not the case, try to remove this column.

    Welcome them

    Kevin Kraft

  • Starting from two data tables, how do you get the values in two columns using values in a column (values get col. If col. A is not null values and get the pass. B if col. A is null)?

    Two tables provided, how you retrieve the values in two columns using values in a column (the pass get values. If col. A is not null values and get the pass. B if col. A is null)?

    Guessing

    Select nvl (x.col_a, y.col_b) the_column

    from table_1 x,.

    table_2 y

    where x.pk = y.pk

    Concerning

    Etbin

  • Change the column delimiter

    Hi all

    I have an input file with delimited by tabs. Can someone tell me how to convert that to '; (semi column) delimited on the output file.

    Thank you

    The delimiter used in the output file is defined in the action script for the export of the adapter on the target system.

    (1) connect to the Client Workbench FDM

    (2) expand the Adpater and navigate to the folder Actions

    (3) open the Script of Action Export

    (4) find the script for the variable strDelim

    (5) assign the separator that you want to use in your output file or semi colon

  • Select the column of values such as 1 row of values (separated by commas)

    Hi all

    I've got a column of values:

    2062
    2063
    2072
    2073
    etc...

    How to choose these values as a single line (separated by commas)?

    Here is my test scenario:
    select '2062' as bacc from dual 
    union all 
    select '2063' as bacc from dual
    union all 
    select '2072' as bacc from dual
    union all 
    select '2073' as bacc from dual

    http://rogertroller.blogspot.com/2009/10/5-ways-to-aggregate-columns-into-comma.html

    There is an option is missing... the new oracle 11g listagg function

    HTH

  • Error trying to filter the column named 'value' in the tab data

    I do not know it is because of the name of the column because all the other columns are working fine, but when I try to filter on the value = 60, I get an error:

    ORA-01722 invalid number
    Code provider 1722

    Is there a way I can filter this column? I tried quotes around column name, 'value' = 60, but that did not help.

    Thank you
    -Bill

    What is the column data type and details? What happens if you (single) quote "60" instead?

    K.

    Published by: - K - 10/28/2009 14:12: corrected apostrophes

  • WARNING: [39028] "DAC" database functions do not correspond to the default values.

    Hi guys

    I get after warning while I try to check the consistency of my deposit.

    [39028] "DAC" database functions do not correspond to the default values. This can cause problems of application.

    How can I get rid of this error?

    Thank you
    Saurabh

    Hello

    Double-click the field not in the connection pool you can click tab features

  • How to add columns with values of each folder?

    Hello

    I am a novice to the Disqualification and here my question:

    I want to be able to add the number of columns in the "not null" by registration, as compared to a reference table and return a value.

    For example:

    Article-1

    Agenda Value-1 Value-2 Value-3 Value-4 Value-5
    Article-1blah blahblah blah blahbla
    point-2blah2blah3

    In this example, the "point-1' has 3 columns populated so I'll compare against my reference data that dictates the number of columns MUST it have completed.» Whether all withdrew, point passes through, but if she does not meet the minimum requirements, it is reported.

    I tried to use the "No. Data Check" tool, which report on the null columns, but I can't understand how to add.

    Thanks for the help!

    In this case, i.e. If you want different thresholds for different records, use a set of baseline mapping family (string) and threshold (number) and use Enhance card on this reference data set to add the value of threshold appropriate to each record data before using the attribute cross check to compare the threshold against the real value.

  • How to use the NVL function to a parameter with comma delimited values

    Gurus,

    It is confusing to me.  I am trying to use the NVL function, but the setting that I'm passing in my cursor contains multiple values with commas.  The NVL function is confused when analyzing the values.

    'Where' cursor clause...

    and nvl (sn.c_attribute1,'x@#$%') in nvl (p_desig,'x@#$%'( )

    translated parameter values...

    and nvl (sn.c_attribute1,'x@#$%') in nvl ('SPRT''GOOD' 'BAD' 'x@#$%') -NVL does not parse the value correctly

    Any idea on how to get NVL recognize 'x@#$%' , if p_desig is null?

    Thank you

    Scott

    HI, Scott.

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

    My best guess, based on what you posted bone is present, that your problem is discussed in the following:

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html

    http://www.Oracle-base.com/articles/Misc/DynamicInLists.php

  • update of several columns of values in another table

    Hello

    I have two tables in a database of 11 GR 2 that contain similar data. There is no FK relationship between the two tables, and for now, I need the data in MASTER to match what is in the SECONDARY. Table data types are the same with the same length.

    Table 1 is called MASTER and columns are:
    MTID
    ADDRESS1
    ADDRESS2
    CITY

    Table 2 is called SECONDARY and columns are:
    SDID
    ADDRESS1
    ADDRESS2
    CITY

    MID and SID are the same on both, but the rest of the columns may be the same or in some cases are different.

    I ran the following query that lets me know there are 20 k odd rows that have different data in these lines (I'm not at work at the mo so do not have the exact query I ran or table column names, but it's close enough).
    select
    m.address1 as maddress1,
    s.address1 as saddress1,
    m.address2 as maddress2,
    s.address2 as saddress2,
    m.city as mcity,
    s.city as scity
    from master m, secondary s
    where m.mtid = s.sdid
    and m.address1 != s.address1
    or m.address2 != s.address2
    or m.city != s.city
    /
    I need to update the rows in the master of secondary school where these values are different. I tried a few different queries updated with no luck.

    I want to do something like
    update m.address1
    set m.address1=s.address1
    where m.address1 != s.address1
    and m.mtid = s.stid;
    But I want to update columns address1 and address2, city of master.

    Any ideas on how I can do this? After you run the update results of my select query should return no rows.

    Thanks in advance and I hope that the question made sense.

    1008991 wrote:
    I got a similar error as well:

    update master m
    set (sm_user_addr_1, sm_user_addr_2, sm_user_city, sm_user_postal_cde)
    = (select sm_user_addr_1, sm_user_addr_2, sm_user_city, sm_user_postal_cde
    from secondary s
    where s.sd_key = m.sm_key
    )
    where exists (
    select 1 from secondary s
    where s.sd_key = m.sm_key
    and (s.sm_user_addr_1     != m.sm_user_addr_1 or
    s.sm_user_addr_2     != m.sm_user_addr_2 or
    s.sm_user_city       != m.sm_user_city   or
              s.sm_user_postal_cde != m.sm_user_postal_cde));
    
    ERROR at line 3:
    ORA-01427: single-row subquery returns more than one row
    

    It simply means that you have several lines with the same sd_key for a given sm_key.
    Is that you have secondaries for one master. You must choose only one line
    If you need additional terms in your where clause

    select sm_user_addr_1, sm_user_addr_2, sm_user_city, sm_user_postal_cde
               from secondary s
             where s.sd_key = m.sm_key
    

Maybe you are looking for