SQL Cursor : Database Object That Provisions Access to Records in a Database

learn more… | top users | synonyms

2
votes
1answer
74 views

PLSQL using cursors or functions to query repeated data

Is it better to declare a commonly used lookup query as a package function or as a function (either returning rows or values or returning a sysref cursor)? Whats the difference? What are the best ...
1
vote
1answer
2k views

SELECT from Function that return CURSOR

I would like to select from a function that return a SYS_REFCURSOR Type value. for example : CREATE OR REPLACE FUNCTION my_funtion ( my_param IN VARCHAR2) RETURN SYS_REFCURSOR IS ...
-1
votes
1answer
84 views

Error with Loop using Cursors - Invalid Object Name with Set = @

Working on a script to Loop through databases to query one table that each Identical Database has with cursors then return result set to table for each database. I think I have the structure for Set ...
3
votes
0answers
621 views

SQL Server 2008 R2 clustered index issue

Last week, we came up with a strange issue on Clustered index. We are using SQL Server 2008 R2 in our organization. A stored procedure is written for our application which contains a cursor in it. ...
1
vote
0answers
42 views

Is it possible to tail a log with a cursor?

I thought the DYNAMIC keyword would work but it doesn't seem to. Basically I have an ASP.NET Application using the log4net AdoNetAppender. I'd like to be able to SELECT * FROM Logging.Logging in a ...
1
vote
0answers
50 views

How to use set-based statement instead of cursor for converting 1 table to two, keeping relations

I'm relatively new to databases and currently working with SQL. I am doing a conversion for a customer. This conversion points to local files on a filesystem. In the old database there simply was a ...
1
vote
0answers
160 views

SQL SERVER 2008 Cursor Problem

I have a table that has some missing values for certain transactions. The value for a particular transaction is going to depend on the value of all preceding transactions. Because the preceding ...
1
vote
0answers
69 views

Map records to a time interval

I have two tables: SamplesTbl contains samples every 5 seconds of a bike ride RxTbl contains the prescribed stages and other values of a bike ride SamplesTbl SamplesID int SessionNum int StageNum ...
1
vote
0answers
2k views

stored procedure returns ERROR 1305 (42000): FUNCTION does not exist

I have a stored procedure and function as below CREATE PROCEDURE ProcName() begin .... DECLARE curs CURSOR FOR select A.PList, B.nid from persons A inner join articles B on A.aid=B.id; .... ...
0
votes
0answers
9 views

Help with logic with cursor

I have a table called chapter, that houses the content for a web ebook. (There are other tables, but this is where the content is contained.) Fields are eid (PK), etype, paragraph_no, content, chid, ...
0
votes
0answers
58 views

Filtering with cursor pagination

We're using cursor pagination as described in this article over a large dataset using PostgreSQL and Django Rest Framework. I'm trying to get a better understanding of the internals of this to solve ...
0
votes
0answers
24 views

Mysql Procedure insert one to many with cursor

I would like to take a course, or just show me the way. There is a table called Questionario from it I get the records in a procedure and organize the data into it. Here is my code:      CREATE ...
0
votes
0answers
77 views

How can I replace the cursor in the below query?

I have this below query which calls a stored procedure that takes only 1 item's attributes at a time. But because of performance problems we are required to remove the cursor. How can I replace the ...
0
votes
0answers
327 views

Mysql cursor alternative / Optimization - each row updates are too slow

I'm looking to optimize my cursor based update or actually replacing it... Situation We're carrying out promotional campaigns and I'd like to track user activity per campaign. Logic Each campaign ...
0
votes
0answers
19 views

Curious Regarding filtering behaviour and performance of where condition

So i have completed the clean up of SQL code that involves four set of queries that partially do the same filtering in where condition , while the rest of the part do their own task specific to each ...
0
votes
0answers
264 views

Save a dynamic cursor for reuse?

I have a search page where users can select from multiple variables. When the page is submitted to a package in the database a cursor is constructed and opened. a snippet to show what I mean ...
0
votes
0answers
951 views

FOR loop oracle query with calulation

I have a list of distinct areas, and would like to track statistics for those districts in a SQL statement. I currently have a setup that runs some summary information, but it doesn't include the ...