XSU: Reading each record at a time

I am using XSU12 to retrieve database contents in XML format. I am passing the Connection and ResultSet objects to create OracleXMLQuery object. I want to read each record at a time and so setting the maxRows to 1 and then getting the xmlstring.
code looks like...
qry =new OracleXMLQuery(connection,resultset);
qry.setMaxRows(1);
xmlString = qry.getXMLString();
I keep this in a loop and read each record at a time. The problem is whenever getXMLString() method is called, the application is hitting the database, which will be a performance issue.
Is there any way to read contents of a table at once and then loop each record at a time without hitting the DB everytime?
Kishore
null

public static char readChar() {
int ch;
char r = '\0';
boolean done = false;
while (!done) {
try {
ch = System.in.read();
r = (char) ch;
if (r == '\r') {
System.out.println("Not a character. Please try again!");
System.in.skip(1);
done = false;
} else {
System.in.skip(2);
done = true;
} catch (java.io.IOException e) {
done = true;
return r;
Try this as an method and then use it..
This code will read will be in response untill you hit the return key but will take only the first character....

Similar Messages

  • Read one record at a time

    Hi !
    One of our Java folks here need at function where he reads one record at at time in id order;
    create table url_recs (id number, url varchar2(4000));
    insert into url_recs values(1,'www.fona.dk');
    insert into url_recs values(2,'www.dr.dk');
    insert into url-recs values(17,'www.ihk.dk');
    select read_rec() from dual; - get id 1
    select read_rec() from dual; - get id 2
    select read_rec() from dual; - get id 17
    select read_rec() from dual; - get id 1 - "no more rows - start all over again)
    select read_rec(45) from dual; - get NULL (no rows with that id)
    select read_rec(1) from dual; - get id 1
    The purpose id for some "round robin" trying to get to some internal URL's.
    Can you give me a hint for creating the function(s)
    best regards
    Mette

    Will successive calls come on the same Oracle session? Or across different Oracle sessions?
    If you're going to call the function multiple times within the same Oracle session, you could store the last value returned in a package variable and select the record whose ID is greater than that value every time the function is called. That's unlikely to do exactly what the Java developer is hoping, though, because the Java calls are likely to bounce between multiple Oracle sessions due to connection pooling. And it'll likely require that the Java developer (or app server admin) adds some code when they get a connection from the pool where they reset the package state. Or it'll require that someone develop a method to keep the Java and Oracle session state in sync.
    Justin

  • Read each record in an Access Database using PowerShell

    I have a fix database that I need to read each record and compare it to an issue. I'm having some issues just reading each record in the specific table, when i run the below code i just get the first entry over and over again. If somone could point me in
    the correct direction on how to read each record it would really help me out.
    $adOpenStatic = 3
    $adLockOptimistic = 3
    $objConnection = New-Object -com "ADODB.Connection"
    $objRecordSet = New-Object -com "ADODB.Recordset"
    $objConnection.Open("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = C:\temp\Fix.mdb")
    $objRecordset.Open("Select * From Fix_Information", $objConnection, $adOpenStatic, $adLockOptimistic)
    $i = 0
    do {
    $objRecordSet.Fields.Item("FixName").Value
    $objRecordSet.MoveNext | Out-Null
    $i++
    while ($i -le $objRecordSet.RecordCount)
    $objRecordSet.Close()
    $objConnection.Close()

    I haven't tested this, but it looks like you're just missing the parentheses after the MoveNext method name:
    $objRecordSet.MoveNext() | Out-Null

  • SQL Query to Read each record in a table

    Can you please share any T-SQL block of statement, that reads reach record row by row
    for example
    Table1
    Row_1 a b c
    Row_2 d e f
    I need to call an stored proc which takes record values as parameters(row by row)
    Equalent logic in c#
    foreach row in Table1
          Sp(row)

    Try
    --Create table
    CREATE TABLE Test1 (
    id INT identity(1, 1)
    ,Val INT
    ,flag CHAR(1) DEFAULT 'F'
    --Feed value
    INSERT INTO Test1
    VALUES (
    1
    ,'F'
    2
    ,'F'
    3
    ,'F'
    SELECT *
    FROM Test1
    --Create SP
    CREATE PROCEDURE yourSp @param INT
    AS
    BEGIN
    SELECT 'Yes'
    ,@param
    END
    DECLARE @i INT = 1
    ,@count INT = 0
    ,@val INT = 0
    SELECT @count = count(1)
    FROM Test1
    WHILE (@i <= @count)
    BEGIN
    SELECT @val = Val
    FROM Test1
    WHERE id = @i
    EXEC YourSP @val
    SET @i = @i + 1
    END
    Thanks
    Manish
    Please click Mark as Answer if my post solved your problem and click
    Vote as Helpful if this post was useful.

  • Reading long text for more records at a time

    Hi all,
    We have a requirement for which that data like textid textname textobject  and language  must  be taken in to an internal table and for each record in the internal table i  have to read the long text inorder to compare the long text for the given search text.
    If i use Read_text inside the loop and endloop it works but it may not be appropriate in performance point of view.
    Is there any function module which can read long texts for more records at a time.
    The long text data in STXL will be in raw data format right? is there any way to convert raw data to normal so that by hitting the STXL i can read the long text data for more than one record at a time.
    Thanks in advance
    sanju.

    HI Sanju,
    Below is a code snippet which describes reading a long text frm the screen and appending it into the internal table.This code is actually to read the text from the screen and inserting a record into STXl and STXH.
    From your query what i understood is that you are storing the long text from the screen into a internal table and so you not want to use the read_text FM due to performance issue.
    Since tdline(tline table) is 132 char long format i use this small logic to read the screen data and append it to my internal table.
    *Data Declarations
      DATA: lv_strlen TYPE i,
            lv_create TYPE boolean,
            lv_desc TYPE string.
      DATA: ls_text TYPE tline,
            ls_basic_text TYPE stxh.
      DATA: lt_text TYPE ztty_tline_tab.
      CONSTANTS:
       lc_tdid TYPE  thead-tdid VALUE 'Z001',
       lc_tdobject TYPE thead-tdobject VALUE 'Z_ALERTS'.
    *Appending the text to the internal table.
      lv_strlen = STRLEN( iv_alert_text-alert_text ).
      lv_desc = iv_alert_text-alert_text.
      IF lv_strlen < 132.
        ls_text-tdformat = '*'.
        ls_text-tdline = lv_desc.
        APPEND ls_text TO lt_text.
      ELSE.
    *logic to wrap text
        DO.
          ls_text-tdformat = '*'.
          IF STRLEN( lv_desc ) < 132.
            ls_text-tdformat = '*'.
            ls_text-tdline = lv_desc.
            APPEND ls_text TO lt_text.
            EXIT.
          ENDIF.
          IF lv_desc+132(1) <> ' '.
            CONCATENATE lv_desc(131) '-' INTO ls_text-tdline.
            lv_desc = lv_desc+131.
          ELSE.
            ls_text-tdformat = '*'.
            ls_text-tdline = lv_desc(132).
            lv_desc = lv_desc+132.
          ENDIF.
          APPEND ls_text TO lt_text.
        ENDDO.
      ENDIF.
    Please award graciously if found helpful.Please do ask me if i have not answered you properly.
    Thank you.
    Message was edited by:
            P M Harish

  • Multiple records displayed on form at one time- 2 lines for each record

    Hello,
    I have a canvas in which I want to display 8 records at at time, so in the data block I specified 8 as the "number of records displayed" value.
    However, the record has too many fields to display on 1 vertical line, so I want to split the fields into two separate lines, so there will still be 8 records but each in two lines.
    How do I do that?
    I'm using Forms 10g. The block is a database block using FROM CLAUSE QUERY , and the canvas is stacked.
    Thanks

    Sandy,
    You will need to set the "Distance Between Records" property for each item in the Multi-Record Block. This will increase the space between rows so you can stack them into two rows. Unfortunately, you can't set this property at the block - so you have to set it for each displayed item.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Read a record several times

    Hi experts
    I hope someone can help me,..
    How I can get that XI to read a record eight times, and each time that XI read a record can it map a source field to target field.
    eg
    Source record:
    "ID" "ObjJDV" "AcumJDV "DesJDV" ObjNCB "AcumNCB" "DesNCB "
    A01  26           195             44           66           29                -55
    next record...
    Target record:
    "ID" "Des" "Obj" "Acum"
    A01  44       26      195
    A01  -55      66      29
    Thanks and Regards,
    Liz 

    Hi Lius
    Yes, I want to split the message in eight messages output, because each input message "Obj" "Acum" "Des" there are eight classifications which should be 3 classifications in a new output record
    eg
    InputMessage
    CarID "Obj1" "Acum1" "Des1" "Obj2" "Acum2" "Des2" "Obj3" "Acum3" "Des3"......"Obj8" "Acum8" "Des8"
    A01,data1,data2,data3,data4,data5,data6,data7,data8,data9......data22,data23,data24
    A02,datax,datay,dataz..
    OutputMessage
    "ID" "Des" "Obj" "Acum"
    A01,data3,data1,data2
    A01,data6,data4,data5
    A01,data24,data22,data23
    next record
    Can XI do this? and how?
    Thanks and regards..
    Liz   

  • Can I plot 2 locations at the same time for each record in a table

    I'm trying to plot 2 Locations (2 points on a Power View Map) at the same time for each record/project in a table
    I can plot 1 location for each project of course with no problem
    but I'm trying to show the Begin Point and the
    End Point for each project at the same time
    Is this even possible?

    First of all THANKS this worked!
    But now I stumbled on another issue. So I actually have 3 tables (and I've adopted them to the file you sent)
    Table 1 => TripData
    Trip
    LongLat
    Location
    Type
    TypeCode
    Size
    NW Tour
    47.568077, -122.320800
    Seattle, WA
    Begin
    0
    1
    NW Tour
    47.035608,   -122.884812
    Olympia,   WA
    End
    1
    1
    Cali Trip
    37.808848, -122.412580
    San Francisco, CA
    Begin
    0
    1
    Cali Trip
    32.682611, -117.178348
    San Diego, CA
    End
    1
    1
    Table 2 =>
    TripInfo
    Trip
    OneLongLat
    NTP
    NW Tour
    47.568077, -122.320800
    1/1/2015
    Cali Trip
    37.808848, -122.412580
    1/5/2015
    Table 3 =>
    ALLTrips
    Trip
    Stop
    Owner
    NW Tour
    1
    Owner1
    NW Tour
    2
    Owner2
    NW Tour
    3
    Owner3
    NW Tour
    4
    Owner4
    NW Tour
    5
    Owner5
    Cali Trip
    1
    Owner6
    Cali Trip
    2
    Owner7
    Cali Trip
    3
    Owner8
    Cali Trip
    4
    Owner9
    Cali Trip
    5
    Owner10
    Cali Trip
    6
    Owner11
    This is how the Diagram View looks like in PowerPivot
    Trip Data => Trip Info <= ALLTrips
    Since I don't know how to post pictures
    The MAP FIELDS are as follows
    SIZE - Count of Stop(s)
    LOCATIONS - OneLongLat followed by
    LongLat (drill down feature)
    COLOR - Trip
    The problem now happens with the drill down feature
    You can either plot OneLongLat which is the general location for each trip
    Or LongLat of each trip which shows the begin and end points
    But you can't use the drill down feature???
    If instead of OneLongLat you use a
    State Column it actually works!!!
    I wonder if it has to do with the fact that both locations used for the drill down are Long/Lat numbers???
    Any suggestions???
    And again Thanks for the response!

  • I need an app or software that records the date/time each time a write something and press enter. This needs to be quick so I can continue writing right after I press enter, and the date/time is inserted for each word. Does this sort of software exist?

    I need an app or software that records the date/time each time a write something and press enter. This needs to be quick so I can continue writing right after I press enter, and the date/time is inserted for each word. Imagine a spreadsheet - each time a write something in a cell and press enter to go into the next cell, I need the app/software to automatically insert the corresponding dat and time. Does this sort of software exist?

    No one here is going to do anything about it. Send feedback to Apple.
    http://www.apple.com/feedback/ipad.html
    Basic troubleshooting steps. 
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 

  • Reading and recording at the same time with AudioUnit

    Hi,
    I am trying to read and record at the same time on the iPhone with AudioUnit. For the reading part I made an AUGraph which works fine, constructed like that:
    NewAUGraph(&_graph);
    _outputUnitComponentDescription.componentType = kAudioUnitType_Output;
    _outputUnitComponentDescription.componentSubType = kAudioUnitSubType_RemoteIO;
    _outputUnitComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
    _outputUnitComponentDescription.componentFlags = 0;
    _outputUnitComponentDescription.componentFlagsMask = 0;
    AUGraphAddNode(_graph, &_outputUnitComponentDescription, &_outputNode);
    _mixerUnitComponentDescription.componentType = kAudioUnitType_Mixer;
    _mixerUnitComponentDescription.componentSubType = kAudioUnitSubType_MultiChannelMixer;
    _mixerUnitComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
    _mixerUnitComponentDescription.componentFlags = 0;
    _mixerUnitComponentDescription.componentFlagsMask = 0;
    AUGraphAddNode(_graph, &_mixerUnitComponentDescription, &_mixerNode);
    AUGraphConnectNodeInput(_graph, _mixerNode, 0, _outputNode, 0);
    AUGraphOpen(_graph);
    AUGraphNodeInfo(_graph, _outputNode, NULL, &_outputUnit);
    AUGraphNodeInfo(_graph, _mixerNode, NULL, &_mixerUnit);
    _generatorUnitComponentDescription.componentType = kAudioUnitType_MusicDevice;
    _generatorUnitComponentDescription.componentSubType = kAudioUnitSubType_RemoteIO;
    _generatorUnitComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
    _generatorUnitComponentDescription.componentFlags = 0;
    _generatorUnitComponentDescription.componentFlagsMask = 0;
    for(int i=0; i< [_urlList count]; i++)
    SoundBuffer* soundBufferTemp = [_bufferSoundList objectAtIndex:i];
    AURenderCallbackStruct renderCallbackStruct;
    renderCallbackStruct.inputProc = MyFileRenderCallback;
    renderCallbackStruct.inputProcRefCon = soundBufferTemp;
    AudioStreamBasicDescription* inputAsbd = [soundBufferTemp getASBD];
    err = AudioUnitSetProperty(_mixerUnit,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Input,
    i,
    inputAsbd,
    sizeof(AudioStreamBasicDescription));
    UInt32 zero = 0;
    err = AudioUnitSetProperty(_mixerUnit,
    kAudioOutputUnitProperty_EnableIO,
    kAudioUnitScope_Input,
    kInputBus,
    &zero,
    sizeof(zero));
    err = AUGraphSetNodeInputCallback(_graph,
    _mixerNode,
    i,
    &renderCallbackStruct);
    This works well, for the recording AudioUnit I did the following:
    OSStatus err;
    AudioComponentDescription audioComponentDescription;
    AudioComponent audioComponent;
    audioComponentDescription.componentType = kAudioUnitType_Output;
    audioComponentDescription.componentSubType = kAudioUnitSubType_RemoteIO;
    audioComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
    audioComponentDescription.componentFlags = 0;
    audioComponentDescription.componentFlagsMask = 0;
    audioComponent = AudioComponentFindNext(NULL, &audioComponentDescription);
    err = AudioComponentInstanceNew(audioComponent, &_audioUnit);
    UInt32 size;
    size = sizeof(AudioStreamBasicDescription);
    err = AudioUnitGetProperty(_audioUnit,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Input,
    1,
    &_soundFileDataFormat,
    &size);
    _soundFileDataFormat.mSampleRate = 44100.00;
    AudioUnitSetProperty(_audioUnit,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Input,
    kInputBus,
    &_soundFileDataFormat,
    size);
    AudioUnitSetProperty(_audioUnit,
    kAudioUnitProperty_StreamFormat,
    kAudioUnitScope_Output,
    kOutputBus,
    &_soundFileDataFormat,
    size);
    AURenderCallbackStruct renderCallbackStruct;
    renderCallbackStruct.inputProc = MyRecorderCallback;
    renderCallbackStruct.inputProcRefCon = self;
    UInt32 one = 1;
    UInt32 zero = 0;
    err = AudioUnitSetProperty(_audioUnit,
    kAudioOutputUnitProperty_EnableIO,
    kAudioUnitScope_Input,
    kInputBus,
    &one,
    sizeof(one));
    err = AudioUnitSetProperty(_audioUnit,
    kAudioOutputUnitProperty_EnableIO,
    kAudioUnitScope_Output,
    kOutputBus,
    &zero,
    sizeof(zero));
    err = AudioUnitSetProperty (_audioUnit,
    kAudioOutputUnitProperty_SetInputCallback,
    kAudioUnitScope_Global,
    0,
    &renderCallbackStruct,
    sizeof(AURenderCallbackStruct));
    err = AudioUnitInitialize(_audioUnit);
    Then in I setup a file to write in:
    - (void) openFile
    OSStatus err;
    err = ExtAudioFileCreateWithURL((CFURLRef) _soundFileUrl,
    kAudioFileCAFType,
    &_soundFileDataFormat,
    NULL,
    kAudioFileFlags_EraseFile,
    &_extAudioFileRef);
    err = ExtAudioFileSetProperty(_extAudioFileRef,
    kExtAudioFileProperty_ClientDataFormat,
    sizeof(AudioStreamBasicDescription),
    &_soundFileDataFormat);
    err = ExtAudioFileWriteAsync(_extAudioFileRef,
    0,
    NULL);
    All this things works well (I check by printing err in the log which I removed here for clarity).
    And then in the callback for recording I do the following:
    static OSStatus MyRecorderCallback(void *inRefCon,
    AudioUnitRenderActionFlags* inActionFlags,
    const AudioTimeStamp* inTimeStamp,
    UInt32 inBusNumber,
    UInt32 inNumFrames,
    AudioBufferList* ioData)
    OSStatus err= noErr;
    AudioUnitRecorder* auRec = (AudioUnitRecorder*) inRefCon;
    [auRec allocateAudioBufferList:1 size:inNumFrames*4];
    err = AudioUnitRender(auRec.audioUnit,
    inActionFlags,
    inTimeStamp,
    inBusNumber,
    inNumFrames,
    auRec.audioBufferList);
    err = ExtAudioFileWriteAsync(auRec.extAudioFileRef,
    inNumFrames,
    auRec.audioBufferList);
    return err;
    (Then I close the file after recording at the same time I close the AudioUnit)
    Now the strange thing is that all this works perfectly well in the simulator: I can record and play at the same time but on the device, the callback for recording is not ran (I check by trying to print something in the log in the callback function.) which men no writing in the file and an empty file in the end.
    Any one has any idea of what could be causing this?
    Thanks
    Alexandre

    Just in case some one might need it, I solved my problem:
    I simply needed to initialize the AudioSession before playing/recording. I did so with the following code:
    OSStatus err;
    AudioSessionInitialize(NULL, NULL, MyInterruptionListener, self);
    UInt32 sessionCategory = kAudioSessionCategory_PlayAndRecord;
    err = AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,
    sizeof (sessionCategory),
    &sessionCategory);
    AudioSessionSetActive(TRUE);

  • Mapping with Scd operator set to type 2 reading source records two times

    Mapping with Scd operator set to type 2 reading source records two times.Records selected count being displayed at the end of execution is double the source record count.This possibly is affecting the performance of the mapping.
    Is this a bug in scd type 2 operagtor in OWB 11gR2.How to rectify this umwamted double loop through the source data selectiom?

    Hi Roelant,
    I think it is important to be aware that although Paris - 10gR2 - is not actually buggy (in this respect!), it is really quite idiosyncratic in exactly how it processes SCDs.
    I followed up on your and Mark's comments, and did an in depth analysis of this topic. It is at http://www.donnapkelly.pwp.blueyonder.co.uk/documents/OWB_10gR2_SCD.pdf
    My conclusions are perhaps of interest to anyone considering doing SCD processing with Paris.
    I'll be doing a follow-up this weekend, and publishing a sort of 'how-to-do-it' guide.
    Cheers,
    Donna
    Message was edited to add the words: "in this respect"

  • Trying to read a recorded file that display the x-axis recorded time stamp?

    How do I read a recorded file with (XY) data, meaning I want to plot the x-time recorded data and be able to scroll back and forth.

    Hi Gina,
    If I understand your question correctly, it sounds like you are trying to plot some data that you have saved in a file. I am assuming that this data is in the form of X and Y values.
    If this is correct, the easiest solution would be to use an XY-Graph in LabVIEW. I would start by using LabVIEW's File I/O VIs to load the data into an array or even a string indicator. You can then parse the data that you need and separate it into two arrays, one for X values and one for Y values. You can then bundle these two arrays together and feed the resulting cluster into an XY-Graph.
    I have attached an example that may help to point you in the right direction when it comes to the actual programming.
    I hope this helps!
    Matthew C
    Applications E
    ngineer
    National Instruments
    Attachments:
    Example.zip ‏61 KB

  • Is there a DJ app for the Ipad that will read the "start" and "stop time" setting for each individual song, as they are set in the song Options screen in Itunes?

    Is there a DJ app for the Ipad that will read the "start" and "stop time" setting for each individual song, as they are set in the song Options screen in Itunes? The Ipod Touch, by itself does not allow cross-fading, therefore when the stop time is edited short, the song jusst truncates then goes to the next song. I tried the DJay ap and while it would crossfade, it would NOT read the song settings for the stop marker. So now I want to try and Ipad and see if there is an app that will READ the Itune stop settings within the song. I do NOT want an app that will allow me to DO the stop marker. I want an app that will READ the stop marker from the song as it is set in Itunes.

    Itunes provides the option for setting the Start and Stop times of each music track.  However, the start and stop times do not synchronize to the iPhone.  I don't understand why this option is even available as it doesn't work when listening to music on the phone.  I have not found another application that will support the start and stop time markets.  I have searched quite a bit for this but can't find anything.  I hope we can find something. 

  • Database adapter for performing sync read of N records at a time

    Would anyone have an example and/or documentation related to performing a select operation in a database adapter where the adapter can fetch N number of records at a time? The database adapter would not be an activation agent/point polling for changes to any records, but invoked in the middle of the process. I searched for this in the samples folder and online but found nothing.
    Any help would be appreciated.
    Thanks.

    Hi,
    Do you want to know the best way to integrate Oracle BPEL to OTM? Then it's simple webservice call from BPEL using http binding.
    If you want to connect to Apps inbound then you can either use DB adapter or JMS adapter or Apps adapter which ever best suites your business requirement.
    Rgds,
    Mandrita.

  • When using pdf reader a message "notes recording" and the time running appears . What is this?

    When I use the pdf reader application a message in the upper ribbon says "notes recording" and also time time running. What does it mean?

        Let's make sure your Smartphone stays smart and keeps your apps working, Jennifer! Can you tell me exactly what it shown about the bot? Did this start after installing any recent applications or updates? Please try a soft reset by holding the Power and Home keys until device restarts.
    Thank you,
    YaleK_VZW
    Follow us on Twitter @VZWsupport 

Maybe you are looking for