How do you return back one record from a NamingEnumeration

how do you return back one record from a For Loop issue
Posted: Jan 4, 2007 9:13 AM Reply
I have the following piece of code and i want to be able to just return one item...
that is return e.next(); but this line doesnt work for below what is wrong
if (attrs == null) {
System.out.println("No attributes");
} else {
/* Print each attribute */
for (NamingEnumeration ae = attrs.getAll();
ae.hasMore();) {
Attribute attr = (Attribute)ae.next();
System.out.println("attribute: " + attr);
/* print each value */
for (NamingEnumeration e = attr.getAll();
e.hasMore();){
System.out.println("value:- " + e.next()));
return e.next();
}

At the end of the loop, the NamingEnumeration has no more elements. You need to call getAll() again.
By the way, please use code tags (above the posting box). You've been here long enough to know that (judging by your registration date).

Similar Messages

  • How do you return back one record from a For Loop issue

    I have the following piece of code and i want to be able to just return one item...
    that is           return e.next(); but this line doesnt work for below what is wrong
    if (attrs == null) {
         System.out.println("No attributes");
    } else {
         /* Print each attribute */
         for (NamingEnumeration ae = attrs.getAll();
         ae.hasMore();) {
              Attribute attr = (Attribute)ae.next();
              System.out.println("attribute: " + attr);
              /* print each value */
              for (NamingEnumeration e = attr.getAll();
              e.hasMore();){
                   System.out.println("value:- " + e.next()));
              return e.next();
         }

    At the end of the loop, the NamingEnumeration has no more elements. You need to call getAll() again.
    By the way, please use code tags (above the posting box). You've been here long enough to know that (judging by your registration date).

  • How do you remove back up data from the memory storage? my storage data states that i have over 80gb of data used for back ups and i dont know why as i use a external hard drive as a time machine .now my 250gb flash storage is nearly full

    how do you remove back up data from the memory storage? my storage data states that i have over 80gb of data used for back ups and i dont know why as i use a external hard drive as a time machine .now my 250gb flash storage is nearly full.. HELP!

    When Time Machine backs up a portable Mac, some of the free space will be used to make local snapshots, which are backup copies of recently deleted files. The space occupied by local snapshots is reported as available by the Finder, and should be considered as such. In the Storage display of System Information, local snapshots are shown as  Backups. The snapshots are automatically deleted when they expire or when free space falls below a certain level. You ordinarily don't need to, and should not, delete local snapshots yourself. If you followed bad advice to disable local snapshots by running a shell command, you may have ended up with a lot of data in the Other category. Ask for instructions in that case.
    See this support article for some simple ways to free up storage space.

  • Need to return only one record from select statement.

    Hello friends,
    I have a scenerio in which code only want to fetch one value from the SQL statement, but in some cases the statment return more then one row due to which ORA-01422 : Exact fetch return more then one row, error comes.
    Can you suggest me to write a select statement that will handel this. I am using the below mentioned select statement:
    EXECUTE IMMEDIATE
    'SELECT rsdn FROM ' || schema || '.table_name' ||
    ' WHERE a = :1 AND b = :2 AND c IN (32,33,34)'
    INTO v_rsdn USING v_a, v_b;
    One question, Can I use Rownum < 2 in Where clause to restrict the select output to only one record ? Please suggest ?
    Regards,
    Rajat

    Well, if rownum=1 could be a trash answer, it would be an issue since we don't know which record you are interested to. Is it one particular ? Is it only to workaround the issue ? Then you may want to manage some BULK COLLECT or whatever else array to receive all the rows as well.
    What are you doing with the rows returned ?
    Nicolas.

  • How to retrieve more then one record from database

    I am doing a SELECT FROM WHERE SQL statement on a database which returns more then one record. I want to retrieve certain column values from the selected records. How do I do that? If only one record is returned, I know I can do a data operation with operation set to 'Get-Retrieve Values from Record' and Record to operate on set to 'Current-Use current record'. I need to find out how to configure to data operation window in the case more then one record is returned by the preceding SQL statement. Depending on the number of records returned, I can dynamically create array variables to store the 'to be retrieved' column values, just dont know how to retrieve them.
    Any help will be greatly appreciated.
    Thanks
    Anuj

    I apologize for not being clear in explaining my problem, perhaps I should have posted an example. Anyways, I was able to figure out the solution. I was doing an 'Open SQL' statement which was selecting multiple records (rows) from a table in the dB. I was storing the number of records returned in a local variable. Then, I wanted to retrieve certain columns of all the selected rows (records). In the "Data operation", I was choosing the 'Record to operate on' as 'Current-Use Current Record'. Changing this field to 'Next-Fetch next record' fixed the problem. I then retrieved the values of those columns into a dynamically created array variable whose dimensions came from the local variable which stored the number of records returned in the SELECT SQL statement. 
    Thanks
    Anuj

  • How do you return a grouped expression from REGEXP_SUBSTR?

    I have the string USERSbthompsonDESKTOP, and I want to return 'bthompson'.
    Something equivalent to this Perl code:
    my ($user) = $string =~ /USERS(.+?)DESKTOP/;
    print "$user\n";
    Output is 'bthompson'.
    -- This does not work...
    select regex_substr('USERSbthompsonDESKTOP', 'USERS(.+?)DESKTOP') from dual;
    returns: USERSbthompsonDESKTOP
    I tried adding a backreference, but don't know how it works.
    select regexp_substr('USERSbthompsonDESKTOP', 'USERS(.+?)DESKTOP', '\1') from dual; -- Return the first expression?
    returns:
    ORA-01722: invalid number
    01722. 00000 - "invalid number"
    *Cause:   
    *Action:
    select regexp_substr('USERSbthompsonDESKTOP', 'USERS(.+?)DESKTOP\1') from dual;
    returns Null.
    Is there a way to return only 'bthompson' from that string?

    Hi,
    In Oracle 10, you can use REGEXP_REPLACE for that:
    SELECT  REGEXP_REPLACE ( 'USERSbthompsonDESKTOP'
                     , '.*USERS(.+?)DESKTOP.*'
                     , '\1'
                     )          AS middle_part
    FROM    dual;In Oracle 11, you can also use REGEXP_SUBSTR:
    SELECT  REGEXP_SUBSTR ( 'USERSbthompsonDESKTOP'
                    , 'USERS(.+?)DESKTOP'
                    , 1
                    , 1
                    , NULL
                    , 1
                    )          AS middle_part
    FROM    dual;

  • How do you go back one step?

    If you want to back up one selection in menu or choice is there something like the Esc key in a browser to cancel last choice?

    Often there's a back arrow on the top left.

  • Bring Back the Records From R/3 To BW

    Hi Friends
    We have a Generic data source and define ERDAT as Delta Field of type Calender day.after data coming to BW,we delete some records by using routine.we bring back these records from R/3 to BW.
    For Example :  01.03.2006 and 02.03.2006 records are available but 03.03.2006 to 03.28.2006 records are not available in bw. how do we bring back these records from
    R/3 to BW.
    (Delta Queue contains:-Date on which the record was created is 03.03.2006)
    Thanks in advance,
    Sam

    Hi,
    There is no other way you can give selections on for the same, and you need to create another InfoPackage and then choose the required dates through the selections within the same.
    And you are not making any changes at the InfoPackage Level? And there is no relevancy whatsoever for the Delta Mechanism.
    You got to pull records from R/3 with the specific Dates you got to make selections in InfoPackage in BW.
    Hope it helps,
    Pradip Parmar

  • The product I bought its not working as i expected, it doesn´t translate the exact information from pdf to excel, how can you help me or how can you return my money back....

    how can you help me

    What about adobé export PDF. ?
    Enviado desde mi iPhone
    El 07/05/2014, a las 23:00, Claudio González <[email protected]> escribió:
    The product I bought its not working as i expected, it doesn´t translate the exact information from pdf to excel, how can you help me or how can you return my money back....
    created by Claudio González in Adobe Reader - View the full discussion
    If you bought Reader, you were swindled, because it's a free program. And it has never been able of converting PDF files to any other format.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6363992#6363992
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Adobe Reader by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • How do you eliminate back the border width from a given selection?

    Perhaps a stupid question, I dont know, but whenever I make a selection and then go to selection>modify>border to select any given width from 1 to 200px, how do you eliminate back any created width? the value 0 is not accepted, only from 1 up. Does this mean I have to deselect everything and start the whole selection back over? that would take a lot of time if my selection was a little complex and took me some time perform it!
    I tried "googleing" that answer but couldnt find anyting so I am coming for help here.

    It's unclear to me what you mean by "Eliminate back".  Do you want just the border to extend inside the original selection?
    Are you recording an action?
    Keep in mind you can save any number of selections under different names via Select - Save Selection, then combine them with the Load Selection function using features like "Overlap" and "Subtract From Selection".
    -Noel

  • How do I transfer back up data from my old time capsule to my new one easily.

    How do I transfer back up data from my old time capsule to my new one easily.

    Before you do this, do you really need all of the old backups that go back many weeks and months?  Most us only ever need to go back a week or two to pick up a file that was accidentally deleted, but that's about it.
    Sure, It is tough to think about deleting all the old backups, so a suggestion would be to keep the old Time Capsule around for a month or two....just in case....but start new backups on the new Time Capsule.  Once you have a month or two of backup history on the new Time Capsule, then you might decide to erase the old Time Capsule and sell it....or just keep it around as a spare hard drive.
    I've tranferred backups a few times in the past, and used up a lot of space on the "new" Time Capsule to do it, and have found that it is far more trouble than it is worth.
    But, you may disagree.

  • How do you move a quicktime movie from one iphoto library to another?

    How do you move a quicktime movie from one iphoto library to another?

    1 - export it from Library A via the File ➙ Export ➙ File Export menu with Kind = Original.
    2 - import it into Library B as you normally would.
    OT

  • Can you have multiple Apple TV's in the same house and network? If so how do you know which one to pick from your Idevice?

    can you have multiple Apple TV's in the same house and network? If so how do you know which one to pick from your Idevice?

    Yes, there are even defaults for naming them, such as LivingRoom, Bedroom, etc, or you can even enter your own name with the remote for each AppleTV.

  • How do i get backed up purchases from an old iphone to a new one, but the only problem is an ipod is backed up into the new phone and i cant get my iphone data on to the new phone because its under i pod

    how do i get backed up purchases from an old iphone to a new one, but the only problem is an ipod is backed up into the new phone and i cant get my iphone data on to the new phone because its under i pod?

    Thanks very much!
    Although I had to add everything again to the playlist, at least I can just copy it over in future!

  • HT5467 how do you change back to the south african store from the american store on your settings??

    how do you change back to the south african store from the american store on your settings??

    Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region...change here.

Maybe you are looking for

  • Pricing procedure - profit margin not coming

    Hi SD experts, I have some problem with my pricing procedure The u201CProfit Marginu201D is not getting displayed /calculated in my sale order, please note that I have maintained Calculation type as u201C11u201D for Profit margin, in my pricing proce

  • Calculating a pie wedge

    Ok I stuck, I have tried several different equations and I can't seem to get this one. int[]  totalAnswersForAnswer totalAnswersForAnswer[0] = 2 totalAnswersForAnswer[1] = 3 totalAnswersForAnswer[2] = 2 totalAnswersForAnswer[3] = 2 totalAnswersForAns

  • Anamorphic.. distort or zoom ?

    hi everybody sorry for asking it again and again but i havnt got any definite answer yet and my deadline is tomorrow... in short: a DV pal 4X3 project that needs to be delivered as 16X9 so it can be viewed on a 16X9 widescreen plasma screen. edited d

  • Combine 2 Answers and divide the results

    Hello, Is it possible to further calculations of results of two-generated queries. I created two queries. The results can I view in the dashboard. However, I am unable to carry out further calculations with the results. Now I wanted to divide a query

  • Access Front Row on older mac?

    I have an older Mac Pro tower about 2 years old. I installed Leopard on it. I recently purchased a new intel tower. I would like to set up my old tower to my HD television and network to it with my new one. I could transfer my home movies to it, etc.