DB Tools Fetch Next Recordset
I am having trouble iterating through the set of recordsets returned from a query that returns multiple tables. I am using the DB Tools Fetch Next Recordset.vi in a loop to iterate through recordsets until they have all been processed. One problem I have is that there is no indication that you have iterated past the end of recordsets. DB Tools Fetch Next Recordset does not produce an eof type indication like you get when iterating through records in a recordset.
My code is attached:
1. Open a database and execute a query that returns more than 1 table (SELECT * FROM tblA SELECT * FROM tblB)
2. Fetch the current recorset data and store in array.
3. Use DB Tools Fetch Next Recordset to move to the next recordset.
Question: What is the stop condition to test for?
Errors propogate through to the close vi which reports:
Error 97 occurred at Rec Get Recordset Properties (R).vi->Rec Fetch Recordset Data (R).vi->Untitled 1
Possible reason(s):
Unknown System Error in Rec Get Recordset Properties (R).vi->Rec Fetch Recordset Data (R).vi->Untitled 1
Any help or example for navigating recordsets?
Thanks,
-cb
Attachments:
Iterate recordsets3.png 21 KB
Hi,
I have a sql query in labview 2011 and i receive a lot of recordsets from it, i can group all records in arrays but i have the same error at the last cycle (i think is normal because it lost each recordset when i use fetch next recorset so the last cycle is consider like EOF and BOF at the same time) but i have other issues, when i tried to free the connection it appear error code 1045 about Rec Destroy and using the execution trace toolkit there are a lot of References Leak, i think maybe one per cycle.
My results are the expected but i have this problems.
I did a very simple example to reproduce my problems, it can use any sql db connection because it doesnt query colunms or data and presents the same things.
Thanks for your time
Attachments:
fecthallrecordset.JPG 83 KB
problems.JPG 71 KB
Similar Messages
-
How to fetch n records at a time from a FM and then fetch next n records
I have a report program which is calling a function module . This function module returns all the records from a table. As the table has millions of records, it cant be returned at a time. How can we return N records from a function module and then return Next n records .The Function module and the report program are in different system .
Thanks in Advance.Use open cursor and fetch cursor.
Check the program as in SAP Help.
DATA: BEGIN OF count_line,
carrid TYPE spfli-carrid,
count TYPE i,
END OF count_line,
spfli_tab TYPE TABLE OF spfli.
DATA: dbcur1 TYPE cursor,
dbcur2 TYPE cursor.
OPEN CURSOR dbcur1 FOR
SELECT carrid count(*) AS count
FROM spfli
GROUP BY carrid
ORDER BY carrid.
OPEN CURSOR dbcur2 FOR
SELECT *
FROM spfli
ORDER BY carrid.
DO.
FETCH NEXT CURSOR dbcur1 INTO count_line.
IF sy-subrc <> 0.
EXIT.
ENDIF.
FETCH NEXT CURSOR dbcur2
INTO TABLE spfli_tab PACKAGE SIZE count_line-count.
ENDDO.
CLOSE CURSOR: dbcur1,
dbcur2.
Regards
Kannaiah -
Af:table fetching next range of data
Hi!
I have a table component on jsf page, property RangeSize set to 25(default). Now I want to invoke a method from my managed bean each time when is fetching next range of data of ViewObject(next 25 rows). But how can I invoke this method? Does anybody have such example?
Thanks for answers.
Jdeveloper version: 11.1.2.2.0
Regards, StanislavHi, John!
Ok :)
I have a transient attribute on ViewObject. Now this attribute calculates by groovy expression. (adf.object.applicationModule.method1 invokes on each row). The problem is that this method isn't trivial and it has some common calculations and some specific calculations for current view row. Now I wan to speed up this thing. I wrote a method in manage bean, that does executes logic like on adf.object.applicationModule.method1. But I divided common calculations(now they have performed once) and specific calculations for current view row(now they have performed in cycle). It calculates faster, but only for first 25 rows. When I fetch next 25 rows, this method doesn't invoke. So, I want to invoke this method after fetching next range of data :) With first variant I don't have a problem with calculation after fetching next range of data.
Regards, Stanislav
Edited by: Stanislav on 17.10.2012 10:01 -
Form Error 40507: unable to fetch next query record
Hi there folks,
I have a Form (10g) where I have a Master Block and a Detail block. However, the other day, there was an Error reported:
ORACLE error: unable to fetch next query record
When we do capture Errors, we also capture the Last Query run. From that, it says that the last record that was queried was in the Detail block (Which is multi-record block) in tabular form. I looked at the Error Message but there is not much information on this Error.
So, it's just a base table block and it has a drop down list which has two values. Any ideas what could have happened?
Thanks!The Block is based on a a table. As a mattr of fact, there are 3 blocks in the form and they are all based on tables. Now, it migth be wrong for me to assume that the detail block in the one that caused the problem just because the Last Query was based on the detail block.
Block 1 is a single record block -- Master Block
Block 2 is a tabular block -- Detail Block
Block 3 is a tabular block -- Detail Block
There are two relations:
Block 1 and Block 2
Block 1 and Block 3 -
Fetch next cursor/ invalid database interruption
Hi Experts,
I would appreciate your help for the following problem:
I am trying to develope something like that:
OPEN CURSOR ... WITH HOLD
loop at ...
FETCH ... PACKAGE SIZE ... into lt_names
insert table ZZ_XXXX ... from lt_names
commit work
endloop.
in the second loop, the FETCH dumps raising the runtime error "Invalid interruption of a database selection"
Runtime Error DBIF_RSQL_INVALID_CURSOR
Exception CX_SY_OPEN_SQL_DB
The cursor is opened "with hold".
Does anybody know, why does it dump?
Cheers
marmsgHi Thomas,
I have four entires in a custom z-table. During FETCH Statements, I use, PACKET SIZE, of 2.
Rough code is as follows:
OPEN CURSOR WITH HOLD w_dbcur1 FOR
SELECT * FROM ztable.
WHILE sy-subrc = 0.
FETCH NEXT CURSOR w_dbcur1 INTO TABLE i_notes PACKAGE SIZE p_pack. "Here packet size is of 2
IF sy-subrc = 0.
Calling some X BAPI Function module.
Calling BAPI_TRANSACTION_COMMIT Function module.
ENDIF.
ENDWHILE.
CLOSE CURSOR w_dbcur1.
Here the problem is, if I give packet size as 30,000, then program is working fine. If I am giving packet size as 2, which less than 4 entries in the table, The program dumps either at first execution of FETCH NEXT CURSOR statement or at the second time of FETCH NEXT CURSOR. Can you provide exact solution for this, and not the links please. Rewards will be provided.
Thanks,
Vijayanand. -
Hello All,
I have the following code which short dumps after losing its cursor position.
OPEN CURSOR WITH HOLD dbcur FOR
select * from ekpo where bukrs in s_bukrs2.
do.
FETCH NEXT CURSOR dbcur INTO table iekpo package size pkgsize.
if sy-subrc <> 0.
close cursor dbcur.
exit.
else.
perform ouput_to_text_file.
refresh: iekpo.
endif.
enddo.
I have millions of records to be extracted and simple select to an internal table causes memory problems. Thus I need to extract a chunk of records write them to a text file, then get the next chunk.
Any suggestions?
Thank you,
JerryGUI Download probably causes problem, writing to a dataset on app server might not cause the problem, maybe you want to try.
Regarding the select, here is some pseudo code outlining what I mean:
clear wa_ekpo.
do.
select * from ekpo into table lt_ekpo up to 10,000 rows
where ebeln > wa_ekpo-ebeln or ( ebeln = wa_ekpo-ebeln and ebelp > wa_ekpo-ebelp )
order by primary key.
if sy-subrc ne 0.
exit.
endif.
download lt_ekpo (appending to existing file)
l_lines = lines( lt_ekpo ).
read table lt_ekpo into wa_ekpo index l_lines.
enddo.
Will run for a while, but should not dump out
Thomas -
Hi all ~ There is a cursor inside a store proc. and at the middle of the loop, became extreamly slow..
and I look into "sysprocesses"
"Fetch Next from cursor_name" SUDDENLY uses huge logical read.~~~~
I am using SQL 2008 R2 SP2 .
Anyone meet this kind of case before ?Hi sakuri_db,
I’m writing to follow up with you on this post. Was the problem resolved after performing our action plan steps? If you would like to, you can post a reply to share your solution and I will mark it as answer. That way, other community members could benefit
from your sharing. If it is not resolved, as other post, please post more information or code for analysis.
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
FRM 40507 Unable to fetch next query record ??
I am working on forms/oracle 10G
there is this form which has a Combo Box list item.
data in this list is fetched from a table 'A'.
while saving data the value in the list item is saved in
another table 'B'
Now when i try to query the form using F11 and Ctrl + F11
it gives me an error :
FRM: frm 40507 UNABLE TO FETCH NEXT QUERY RECORD
please guide what should i do ?? ...
regardsDetails of the FORM :
a) there is only one table
b) we are using 2 datablocks . parent and child. This is because the child is
displaying about 5 records. No parent child relation is set in the datablocks yet or in the table. can we do this in a single table ?
c) now the user shall select a value from the activity list ( combo box ) . The date and time are auto populated in when new form instance. User then enters data for the child records and clicks save.
d) data is save correctly.
e) but while querying data that is saved it errors out saying that : FRM 40507 Unable to fetch next query record
Will we have to define a parent child relation in the single table or in the datablocks ?
i m really confused ??
Regards -
DB Tool Fetch RecordSet Data Bug?
I have a routine that do a fetch all on a csv file. If you use condition TPTemp=23, you will get row 5139. In that row, you have a value 0.98. However, depending on what you put in the csv file, you will get 0 for that number instead. What is going on?
Kudos and Accepted as Solution are welcome!
Attachments:
EnergyTP.csv 4 KB
DB_CSV Query.vi 34 KBHi Jackie,
Thank you for much for looking into it. I am doing a sql query with a csv file, because I would like to only select rows that meet certain criteria, and I would like to make my code more transparent when I convert the program to query a real database table instead of a csv file
It seems like the values are not being read into an variant correctly. If you look at the variant, you will see that the values are incorrect. Is it possible that when the subvi read the csv file, it doesn't know what format the values are supposed to be in and misread them? Thanks!
Yik
Kudos and Accepted as Solution are welcome! -
Is there an easy way to fetch next/previous record in Apex?
I am new to APEX/Oracle, but have a lot of expierence as a mainframe programmer and some experience with SQL.
I have been tasked by my boss to create a set of pages in an application as follows.
Page 1: Select an Employees Name and go to Page 2.
Page 2: Display Employee's Biography Information.
Add a "Next Employee" button and a "Previous Employee" button that will fetch the next/previous Employees Biography info respectively.
In essence, he wants a query with every employee's biography information with the employee selected on page 1 used as the starting pointer.
I have successfully built "select an Employee's name on page 1" and "display his/her info on page 2" with a query that returns a single record.
What I can not figure out is how to get a next and previous button to get the next or previous record in a multi record query, using the intially selcted employee as the intial pointer.
Is their an easy way to build this using built-in APEX functionailty, or will it require programming to achieve this requirement?Bob,
I installed the Aria application, but now I wish I'd run the preview first. It's a cool application, but I don't see anything like what greich requested. I'm looking for the same thing.
<ol>
<li> and clicked the Edit or View Details button for an individual. </li>
<li>That takes me to a custom Form page that shows one person. </li>
</ol>
I'm trying to imagine how I'd code buttons for that Form page to let me click to see the next or previous person on that same form. My mind gets totally boggled when I consider that the user might have filtered the report to only show a few records. How do I have any idea what those IDs were and what order they were showing in, to know which is the next individual.
My only thought it to create a process on the report that could save primary key (e.g. employee ID) to a table or Apex collection? Then the form button runs a process that finds the current ID then uses next or previous?
I'm not sure how I could capture the PK in the report in order to save it.
Does this make sense? Anyone got a better idea?
Thanks,
Stew -
Fetching next value of a sequence into a variable(TextField)
Hello All,
I have another little issue that i hope someone can resolve.
I need to grab the "nextval" from a sequence, insert it into a text field or variable then read this variable to create a record in two individual tables ( one is for a PK other is the relating FK in another table )
eg:
fetch sequence.nextval into :P1_item1
then
insert into mytable values (:P1_item1, ........ )
insert into myothertable values (somekey, :P1_item1, ........ )
I assume this needs to be in a process somewhere in the application but do not know where or the code to achieve it.
Any help will be much appreciated
Thanks
RobertThanks for your reply. Unfortunately i could not find my answer on the link you sent me.
Any other ideas ? or do u know the code i could use to make this work ? -
Tool Bar next to ebenen panel?
I saw this in a tutorial from Adobe´s Russel Brown but he mssed to explain how he got the tool bar there.
How is this accomplished?
I work in PS CS6 in German but also familiar with the english version.Hello!
It's not the toolbar, those are collapsed panels. (You can dock the toolbar by grabbing it by the series of small lines on top, and snapping it to your panels)
Dock some panels on a second column, they need to have the blue highlight on the side of the panels. Then, once all panels are docked under, click the double arrow on the top right of the new column to collapse them, then move the width of the panels until they are just icons.
Hope this helps! -
Best way to fetch next/previous N records without re-querying DB?
because the db query is very expensive I only want to do this once and the web app should "remember" all the records. any suggestions? Thanks!
BobXu wrote:
I have tried my best to improve on the backend, but it is not something so I better find a way to solve this problem on the front end.
I am thinking maybe Ajax. any thoughts?Ajax isn't a panacea to fix all your woes.
You will want to optimize your DB queries. If a single access is expensive, break it down into several smaller queries and only pull out a sub-list of data for each page. If you don't need to display every piece of data at a single time, then why ask the database for it all? Hop on over to the JDBC forum and ask them if there isn't room for improvement in your query, table format, or access style.
That said, if the contents of the database are relatively static and paging won't help for some reason, and there is nothing you can do to clean up the connection to the server, you might try caching the results to a local file system or a smaller database that is on the same machine as the web server. -
i have a table which is built on a transient VO which is populated programatically from external data source. the code which populates this VO returns only 50 records when the user navigates to this page for the first time. my requirement is that when user navigates to the end of the table after navigating 50 rows in a table, he / she should be able to see more records. how can this be achieved best in jdev 11 1 1 6.
Have you tested your app with application module pooling turned off?
The problem might be activaton/passivation of am.
See if you can reproduce the problem this way. I guess that when a vo gets passivated only the qeurry gets saved. When activated yhr saved query is executed again. As you use transient rows, they come back empty.
Timo -
Urgent help please ! Get data after executing query
Hi all
I have stored some data's with labVIEW to mysql by writing query using db tools execute query.vi.
For fetching those data's also wrote a query(select* from....)using the same tool .
the query got executed . What tool i have to use to retrieve the data from mysql to a labview array.( the fetch recordset data.vi tool is not fetching.)
Thanks
Attachments:
db.JPG 11 KBFirst, make sure your query string is correct, no typos, the table and fields exist. If all of this is correct, try using Fetch Next Recordset instead of Fetch Recordset. I've had to do that with some databases. For some reason, the record pointer doesn't advance with the query. Or maybe the record pointer is pointing to empty space and the query places the record found as the next record instead of the current record.
- tbob
Inventor of the WORM Global
Maybe you are looking for
-
ITunes setup on a NAS with multiple windows users - how?
iTunes setup on a NAS with multiple windows users? I am very confused on what is the best way to handle this setup for my friends family. Any help would be appreciated. Sorry in advance as I know this is a long winded post - I have a feeling this w
-
These problems are happening on my iMac at home. I can log into Creative Cloud no problem, however as soon as I try and open an application, whether it's an old version or CC 2014, Adobe Application Manager opens and tells me that membership has expi
-
Hi, I am a MacBookPro user (10.6.8). When I tried to open my iTunes, it says "This copy of iTunes is corrupted or is not installed correctly. Please reinstall iTunes." I really dont know what to do, I would be glad if you could help me.
-
How to sync pictures in iTunes
I have vista, and all in all everything works fine with iPhone, however, I can not figure out how to synchronize pictures in iTunes so that the pictures taken by iPhone are transfered to the computer and vice verse. I did setup folder for this and po
-
Can someone my Bluetooth is not working on my iPhone 4S and never has I can never find any devise I search for even if others can. Any suggestions? Thank you