How to check whether or not the value is already in the collection

Hello

I'm in the analysis of a donkey of xml file assigning values to the collection.
For each new record, that I am available for capture of xml, I need to check if this value already exists in the collection or not, and then only I must add this value to the collection.
How we do that. I am not able to check whether or not it is already present in the collection. Help, please.

Here is my code


TYPE tab_A_type_rec IS RECORD)
Name Varchar2 (50);
);

TYPE tab_A_type IS TABLE OF THE tab_A_type_rec;

pkv_A_tab tab_A_type: = tab_A_type ();


l_nl: = dbms_xslprocessor.selectnodes (dbms_xmldom.makeNode (l_doc), ' / / List "");
for cur_rec in 0... dbms_xmldom.GetLength (l_nl)-1 LOOP
l_n: = dbms_xmldom.item (l_nl, cur_rec);

pkv_A_tab.extend; -----
pkv_A_tab (pkv_A_tab. (Last). Name: = dbms_xslprocessor.valueOf (l_n,'Name / text () '); -I have to do these two steps only after checking whther that value is already present in the collection pkv_A_tab or not... What will be the stated case.

end loop;


Thank you
Pramod

Peter Gjelstrup wrote:

Then in the final use TOGETHER to eliminate duplicates.

The only problem - cannot use SET operator nested table records ;) or even on a table nested objects, unless the object type has map/delivery orders. Now if in real life, record type has only one attribute - NAME OP can just create type of TABLE OF VARCHAR2 (50). Then:

SQL> declare
  2      type tab_A_type is table of varchar2(50);
  3      pkv_A_tab tab_A_type := tab_A_type('A','B','C','A','B','C','D');
  4  begin
  5  if 'B' member of pkv_A_tab
  6    then
  7      dbms_output.put_line('Found B.');
  8  end if;
  9  pkv_A_tab := set(pkv_A_tab);
 10  dbms_output.put_line('List of distinct elements:');
 11  for i in 1..pkv_A_tab.count loop
 12    dbms_output.put_line(pkv_A_tab(i));
 13  end loop;
 14  end;
 15  /
Found B.
List of distinct elements:
A
B
C
D

PL/SQL procedure successfully completed.

SQL>   

SY.

Tags: Database

Similar Questions

  • How to check whether or not the arraycollection collection is initialized

    Hi all

    I am bit new to use the collection arraycollection in flex. I'm having this particular scenario, where I get Server data in a table. So I have to check if the arracollection I created is initialized or not. If it is not initialized I need to initialize it or other wise, just add collection from table to table. Here is the code snippet

    currentTrajectory = new collection ArrayCollection (event.result as Array);

    var _multiTrajectoryEvent:MultiTrajectoriesEvent;

    _multiTrajectoryEvent = new MultiTrajectoriesEvent (MultiTrajectoriesEvent.DRAW_AUTO_TRAJ);

    If (!) (_multiTrajectoryEvent.trajectories.source is nothing))

    {

    _multiTrajectoryEvent.trajectories.addItem (currentTrajectory);

    }

    else

    {

    _multiTrajectoryEvent.trajectories = new ArrayCollection ([currentTrajectory]);

    }

    But unfortunately the above code does not work for me, because the arraycollection collection is not initialized first, there is no way of checking me if it is initialized later or not as the compiler gives me the error checking to null...

    Can any Walter suggest how can I check if the table collection is initialized or not?

    I would appreciate any suggestions and thouhgts for the same

    Thank you

    Akshay

    Sorry to say, but it's not the right approach...

    I'm abt don't know what is exactly done so I'll give a generic example...

    I have an ArrayCollection collection...

    private var arrC:ArrayCollection;

    Maybe it's getting used internally in several places, so you be sure if she be initialized already or not. Then use a code something like that...

    If (arrC! = null & arrC.length > 0)

    {

    ...

    ...

    }

    If you are using

    If (arrC.Length > 0)

    {

    ...

    ...

    }

    and it is not initialised it will give exceptional at the time to compile...

    For a logic if(a && b) be true both a and b must be true, so if same first one (a) is false it will not evaluate the second logic (b).

    Thus, the previous logic works.

    concerning

    Nishant

  • How to check whether or not a user session is null

    Hello

    I use Jdeveloper 11.1.2.2

    I have a some Junit test case execution use case, that's the problem I have:

    There's Junit tests that are written for some VO while tests of insert and update operation to Junit it is two General required columns Created by and updated by to engage in the database.
    These values are taken from the UserName of the current UserSession.

    So to get these values for each user, I thought to display a JPanel before the test is run, where the user enters the user name and password which is validated and the user is verified.

    First of all, I need to check if there is a session presents or not. To check this, I wrote a createUserSession() and liked on the inside:
    if(fixture.getApplicationModule().getSession().getUserData().isEmpty())
    Would that be to show the Jpanel and the details of the user and verify the user.

    But when executing the test itself, I found that the session is already present, now I just at the entry values based on who is the user.

    But Junit run the tests in the order in which the tests are written. I therefore call this in all the test cases.

    The Question is:
    How can I check if the session is already present or not, so that I don't have to ask the user every time of each test runs to enter the user name and password?

    Thank you
    Nigel.

    Edited by: Nigel Thomas July 30, 2012 10:26

    Hello

    ask yourself why you create test users and then automatically connect them as Jan Vervecken made in the net, I told him you. This way your test cases run without user intervention. To test if a session exists for a user, I would put a custom property in the user data. If this property exists, the user session is an existing one. However, make sure that the information you save user data survives passivation, because otherwise the information you get out of it is not accurate. See: http://tompeez.wordpress.com/2011/07/08/jdev-always-test-your-app-with-applicationmodule-pooling-turned-off/

    Frank

  • When you install age of empires 3 it progresses quite far ahead, it reports an error and to check whether or not the sound.bar file on the disc (cd 2).

    I ask to check if the file sound.bar is on is the cd or not. I'm unable to explore the disc on my computer to determine if the file is there or not. Overall, the progress bar indicates that the installation was almost complete. There are some light scratches on the cd. All solutions? I'm unable to explore the disc on my computer to determine if the file is there or not. Overall, the progress bar indicates that installation was almost over before I got this error message. Is there any way to get this file, as I suspect the cd is damaged as it has a few light scratches on the cd. All solutions?

    Hello

    1. don't you try to install the game in the other computer with the same disc?

    If you are not able to install the same game on another computer it clearly seems to be a problem is with the CD, then I would you to see link and check if it helps.

    How to replace lost, broken, or lack of Microsoft software or hardware: http://support.microsoft.com/kb/326246/en-gb

    For your information:

    Error message when you install a program of mapping or game from Microsoft: http://support.microsoft.com/kb/258496

    Hope this information is useful.

  • Check whether or not the magsafe power adapter is authentic

    Hello! I bought some 60 W MagSafe 2 Power adapter MD565CH/A, 85 W MagSafe 2 Power adapter MD506CH/A & 45 W MagSafe 2 Power adapter MD592CH/A but the serial number in each category is same for example there are 10 units for 60 W & all have the same serial number. I have a doubt, be they authentic shape Apple or not. Kindly help.

    You will need to call Apple for confirmation.

  • check whether or not a concurrent request is complete the backend

    Hi all
    I want to check whether or not the competing applications is complete the backend using the API. I discovered that FND_CONCURRENT.wait_for_request can be used, but inside this procedure they use dbms_lock.sleep command to delay treatment. I used the same dbms_lock.sleep in my code, but does not correct results.
    Please you siggest me on solutions workaround that needs to be done to get the exact time of the concurrent request will have to fill.


    Thank you and best regards,
    Mahesh

    Hello

    You can get the same information in table FND_CONCURRENT_REQUESTS (API of FND_CONCURRENT of the readings of the same table).

    If you want to continue to use an API, see if you can use FND_CONCURRENT. GET_REQUEST_STATUS (Please check if it is a public API).

    Kind regards
    Hussein

  • I found an old vista home basic dvd with a key, how can check whether key works but not install it?

    I found an old vista home basic dvd with a key, how can check whether key works, but not install it? some dvd install can be live boot from themselves too [password required for a direct start?]?

    Hello

    You must install it to see if it is legal to do so.

    There is no public database of product keys.

    See you soon.

  • How to check a program if the device is currently locked?

    How to check a program if the device is currently locked?

    Is there an API that can tell me who?

    I used DeviceInfo.isPasswordEnabled () but it doesn't seem to do the trick

    You can use the ApplicationManager.isSystemLocked () method to determine whether the BlackBerry is locked.

    Concerning

    Bika

  • I'm on disk check utility, how do I know when its done and how I know whether or not, I have a problem?

    I have Microsoft windows, I have a laptop, windows vista, I ran CCleaner, Speedy PC Pro, Uniblue registry Booster and security system from Microsoft that comes with this system. Now, whenever I run these or any program on my computer that has to do with safety or clean my computer or any fixing problem, I get a message that appears from the bar saying run disk utility to check off tasks? I know you probably want to know what the message says, but I can tell you that he keeps telling to run check disk utility.  the full message is "corrupt Registry Booster.exe file or directoryc:\program key is damaged and unreadable. Run the chkdsk utility.  What can I do to fix this?

    ... Initially re-read your error message.
    ...." Corrupt Registry Booster.exe file the file or the directoryc:\program

    data\microsoft\crypto\RSA\machine keys is damaged and unreadable.

    Your registry booster has damaged your system.

    Uninstall Speedy PC Pro and Uniblue Registry Booster. They is snake at best, disastrous at worst oil.

    As the CCleaner, it's ok as LONG as stay you away from registry option in the left column. Never use registry cleaner... period.
    Registry cleaner could be useful in the hands of accomplished computer experts.
    In the hands of regular users, it's a time bomb.

    You said... more security system from Microsoft that comes with this system.
    Only the security system that comes with the operating system is Windows Defender and Windows Firewall.
    This is not enough. Advise to install Microsoft Security Essentials...
    It's a free program and good enough for home use.
    A point to note: stop Windows Defender because he has his own Defender. 2 defenders running on the same computer will create conflicts. It's normal.

    How long disk check run...

    Depending on your system. More "junks" in the system, more time. In general, it takes some time. When it runs, don't interrupt, don't stop the computer.

    How do you know you have a problem or drive no check...

    The system will create a log of disk check. Here's how to access the Journal:

    Start > in the search box, type event viewer > Enter >
    the column on the left, click on the pointer before Windows logs
    Select (left-click) Applications, and then
    Click with the right button on Applications
    Select search
    in the 'search box', type chkdsk
    Click next
    leave the search window
    the middle column, you will see Wininit 1001, click
    right column, under the event 1001, Wininit, click Properties of the event
    A new window with the diskcheck newspaper.
    You can use the slider to display, or click the button copy and then paste it to the one that you want to use, such as Notepad or wordpad.

  • How to check that I have the fax service installed in my computer, such as claimed by the manufacturer?

    the fax console icon is on the computer, but I'm never able to send a fax.

    How to check that the fax program is intact in the computer?

    My outgoing faxes are never sent.

    Cannot find a SEND BUTTON for outgoing faxes.

    y t

    Hi mavis,.

    You can read the following article that should help you to check the same.

    HOW to: Solve common fax problems in Microsoft Windows XP

  • How to check leap year between the years earn a new degree?

    Hi all
    I developed a report to print a report of emplyees who earn a new degree between towing dates entered by two parameters of the user.
    I used this code to do this:

    SELECT ALL E.EMP_SID, E.EMP_FULL_NAME, E.FINANCIAL_NO
    (CASE WHEN E.qualification_sid = 1104 AND E.degree_sid = 8 THEN
    (TO_DATE (E.degree_DATE, 'DD-MM-RR') +(365*M.spe_per) + 1).
    ON THE OTHER
    (TO_DATE (E.degree_DATE, 'DD-MM-RR') +(365*M.yea_per) + 1).
    END)
    COMM_degree,
    OF INDUSTSRIE E, M DEGREES
    WHERE (CASE WHEN E.qualification_sid = 1104 AND E.degree_sid = 8 THEN
    (TO_DATE (E.degree_DATE, 'DD-MM-RR') +(365*M.spe_per) + 1).
    ON THE OTHER
    (TO_DATE (E.degree_DATE, 'DD-MM-RR') +(365*M.yea_per) + 1).
    END)

    BETWEEN TO_DATE (: P_F_DATE, 'DD-MM-RR') AND TO_DATE (: P_L_DATE, 'DD-MM-RR')
    AND (E.degree_SID = M.SID)
    ORDER BY M.SID DESC, E.EMP_FULL_NAME

    Now there is an error in the data led to some employees with a leap year in the year to earn income
    for example: an employee has a degree date of 10/01/2011 and win it supposed the next level is 10/01/2016 but the report gives as 30/09/2016 because there's one year leap year 2012 which have 366 days 365 days I count in the code!
    If there is something mysterious in the code, please do not hesitate to ask!
    Please how to fix this?

    Note: I use reports 6i.

    Hello

    Try ADD_MONTHS(SYSDATE,12) - instead of 365 DAYS

    IF ANY PROBLEM WE THE KNOW

  • How to check if this is the first record

    Hello..
    I have a block with some elements SL, STAFF,..., NAME of several record.
    during data entry, I want to check if this record is first record...
    If it's trees folder I need to know the SL of the latest entry of DB and based on that generate next SL.

    "Let me know how to check if my first record..?

    thnx...

    ManiKanchan wrote:
    Hello..
    I have a block with some elements SL, STAFF,..., NAME of several record.
    during data entry, I want to check if this record is first record...
    If it's trees folder I need to know the SL of the latest entry of DB and based on that generate next SL.

    "Let me know how to check if my first record..?

    Try this,

    if GET_BLOCK_PROPERTY('block_name',CURRENT_RECORD)=1 then
    your_code;
    end if;
    

    Hope this helps

  • How can I check the updates for Adobe Audition CS 5.5 version. I want to use the software after not using it for three years or more. I can't find any page that tells me whether or not the software updates are available.

    I want to check the updates of Adobe Audition software, purchased as part of the CS programs 5.5 package.

    Beginning of the updates here and product selection, read to see if you need to install updates in the order of the numbers, or if updates are cumulative for the product http://www.adobe.com/downloads/updates/

  • How do I know whether or not the instance is affected?

    Hello

    Automatic activity or screenflow how would I know if instance has been attributed to a participant or not?

    Thank you

    Hello

    Please find the code below and make the necessary changes in it.

    Write the following code in the workflow activity of automatic screen, but before that you must pass the instanceid as an argument to the screen flow.
    In the process as well as screen brand flow layer an instance instanceid as Intvariable.
    Make a variable instanceidArg of the argument as a Int in the process and screenflow layer and map accordingly so that it will take the instanceid of process layer to the layer of screen flow.

    Assign instanceid = id.number; in automatic business process layer but before the global interactive activity where you maped the screen flow.

    Write the following code in the automatic screen workflow activity.

    logMessage ("= instanceid =" + instanceid); InstanceID is the id of the instance that you had a layer of process.
    ProcessService ps;
    InstanceFilter instF = InstanceFilter();
    ps.connectTo (url: Fuego.Server.directoryURL, user: "", password: ""); In the studio the username and password will be the same
    logMessage ("Connected");

    instF.create(processService: ps);
    SearchScope = instF.searchScope (participantScope: ParticipantScope.ALL, statusScope: StatusScope.ONLY_INPROCESS);
    is the id of the process where you want to know the id of participant assighed
    instF.addAttributeTo (variable: VarDefinition.processid, comparator: Comparison.CONTAINS, value: "/" + "");
    instF.addAttributeTo (variable: VarDefinition.INSTANCE_NUMBER, comparator: Comparison.IS, value: Int (instanceid));
    Instances of [] Fuego.Papi.Instance = getInstancesByFilter (ps, filter: instF);

    {foreach (instance in instances)
    logMessage ("Assigned?:" + instance.participantId.empty);
    logMessage ("instance.participantId:" + instance.participantId);

    }
    ps.disconnectFrom ();

    In the runtime if assigned?: true which means that the instance is not assigned or false means assigned.

    Sidonie

  • How will I know whether or not the home Preium is 64 bit version?

    I'll update my memory, but do not know if my version of Vista is 64 bit or not. I'm under the home edition with Service Pack 2 Premium. System info tell me if it is 64 or not? If that's the case then I guess I have the 32-bit version and will move to 7.

    Help please

    How will I know if my computer is running 32-bit or a 64-bit version of Windows?

    To find out if your computer is running 32-bit Windows or 64-bit, follow these steps:

    1. System opened by clicking on the button start , clicking Control Panel, clicking system and Maintenance, and then clickingSystem.

    2. Under system, you can view the system type.

    "A programmer is just a tool that converts the caffeine in code" Deputy CLIP - http://www.winvistaside.de/

Maybe you are looking for

  • Install my own Pro 8.1 Windows

    Hello I have a HP Envy 17-J010EL. I will install my own, new, copy the retail Windows Pro 8.1. Because I prefer to install a different OS rather than replace the existing, buil-in HP OEM Windows 8, I prepared the second disc to install it. I shared t

  • in preview windows8 printer problem

    Sir I use the version of 64-bit windows 8 developer preview when I formatted the system and installed the printer drivers it worked normally for a few days but after that it stopped working so once again, I have formatted and installed the printer th

  • How to stop the electronic download open on another computer on my network

    I have a laptop and my desktop, when I open my email on my lap top that the email still goes to my office as if it had never been opened.  I pay for this duplication and how to stop it I use x.p on my laptop and my office 2000

  • Twitter page

    Whenever I try to connect to twitter I get an exclamation point in a triangle at the lower left of my screen. It is said that permission denied, twitter.com, Code 0, line 726, tank 13. -What it means and how to get twitter?

  • Help! I can't find the scroll bars in Word, Office 2010!

    Shortly after that I installed Office 2010, I was desperately trying to repair one imagine that I had added to my document, but somehow instead, I turned off scrollbars for windows! I tried to retrace my steps, but have no idea of what I did. The scr