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
852
questions
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
-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, ...
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(...