Skip to main content

Questions tagged [database-cursor]

Use this tag for programming-related questions about database cursors. If your question is specific to a particular database, tag the database type too.

database-cursor
0 votes
1 answer
42 views

Are PostgreSQL's cursors per connection or something else?

I'm using node-postgres (pg) and its pg-cursor extension. I noticed when reusing the same connection between multiple cursors, it locks due to what I would assume that a single connection is only able ...
Daniel A. White's user avatar
0 votes
1 answer
61 views

Dynamic SQL and cursor iteration in Snowflake

I've been sitting all weekend, trying to figure out the implementation of cursor iterations in Snowflake procedure blocks. The goal is to create a dynamic procedure that when called checks all ...
Paul's user avatar
  • 15
0 votes
2 answers
92 views

Looking for a way to avoid a cursor

I am trying to create a report that, among other things, lists how many new patients were seen in a particular month. A "new" patient is someone who has either 1) never been seen before, or ...
JohnT's user avatar
  • 13
1 vote
1 answer
58 views

Cursor object is not found in Visual FoxPro

I have a database containing a table called client that has, among others, column names like id, first, last,... It is projected to extract each record and from it, assemble a PDF file named after ...
user10191234's user avatar
0 votes
0 answers
32 views

AttributeError: 'NoneType' object has no attribute 'cursor' in some of the device

I am using python flask and mysql to run a simple login system. I get error "AttributeError: 'NoneType' object has no attribute 'cursor'" after i run the system and try to insert record into ...
Taylor Winnie's user avatar
0 votes
1 answer
29 views

MySQL stored procedure error with two cursors in the same routine "ER_SP_CURSOR_NOT_OPEN: Cursor is not open"

In this stored procedure for an inventory system I want to process a packaging order for a product in kg according to the type of container and its capacity in kg. This finally stores the existence of ...
Kibuya Shanon's user avatar
0 votes
1 answer
35 views

Declaring 2 Cursors in a Stored Procedure | SQL Error [1338] [42000]: Cursor declaration after handler declaration

I'm trying to declare two Cursors in a stored procedure but it shows "SQL Error [1338] [42000]: Cursor declaration after handler declaration Cursor declaration after handler declaration Cursor ...
Sabri's user avatar
  • 1
0 votes
1 answer
73 views

Error when calling cursor.execute with psycopg2 sql.SQL object

I am trying to execute a raw update query using psycopg2 in django. The code is as below: from django.db import connection from psycopg2 import sql model_instances_to_update = [] for model_instance ...
Lax_Sam's user avatar
  • 1,119
1 vote
1 answer
34 views

Empty tables specified from a list of table names without using a cursor

I have temporary data that is being uploaded from an external source into empty SQL Server tables. But not always the same tables. I need these tables to be cleared after a MERGE procedure is run. The ...
Garry_G's user avatar
  • 195
0 votes
1 answer
55 views

ORACLE: Build 'INSERT INTO' statements from SELECT * results

Beginner in PL/SQL here. I am trying to build a script that takes the results from a table "ADMIN.ACCT_HRS" and creates INSERT INTO statements for each row, so that I could feasibly rebuild ...
mRminer's user avatar
  • 11
0 votes
1 answer
153 views

Optimized Alternative of CURSOR

I have the following SQL query that uses CURSOR to iterate over each row of the INNER JOIN result. This is not performing well for large sets of data. I need to optimize the query. I tried to find a ...
yuv's user avatar
  • 586
0 votes
1 answer
57 views

Using a cursor in SQL Developer to generate a subsequent query for each record

I have an SQL Developer query in which I would like to use a cursor to generate subsequent select statements. But, I'm doing something wrong. I don't seem to be using the cursor correctly. Here is my ...
Tim's user avatar
  • 631
0 votes
1 answer
150 views

Find and update duplicate values held in a column with a unique constraint? - Msg 402 The data types are incompatible in the add operator

I need to create a SQL Server query to clean up an old database by ensuring all non-unique values in columns with a unique restraint are updated to be unique. To do this I was thinking to find all ...
Tyson Gibby's user avatar
  • 4,182
-2 votes
1 answer
36 views

MySQLdb call procedure with long name

In the documentation for callproc, it uses the procedure name prepended by an underscore and appended with an underscore and the parameter's position. When calling a stored procedure with a long name, ...
Dewey Vozel's user avatar
  • 2,363
0 votes
2 answers
68 views

SQL cursor take too long to complete

DECLARE orderid NUMBER; customerid NUMBER; channel VARCHAR2(20); amount NUMBER; CURSOR orders_cursor IS SELECT order_id, customer_id, channel, FINAL_PROFIT(...
Giannis Kalogridis's user avatar

15 30 50 per page
1
2 3 4 5
57