5,904 questions
2
votes
2
answers
116
views
Pros and cons of `INSERT INTO` versus `UNION ALL`
I am working with an Oracle database in which each year's data is stored in different tables. I am not the DBA so I cannot change that. Also, I do not have the permission to consult execution plans or ...
-4
votes
1
answer
96
views
How do I retrieve the primary key of the updated record?
I have this insert query for my MariaDB 10.6.19 database:
CREATE TABLE manufacturers (
manufacturers_id int(11) NOT NULL AUTO_INCREMENT key,
manufacturers_name varchar(32) unique NOT NULL,
...
2
votes
2
answers
108
views
Proper way to locate the position of a single newly inserted row based on order by clause immediately after insert?
After inserting a single row of data into a table (always a single row), I'd like to return to the application code the relative position of that row based on an order by clause. Thus, the application ...
1
vote
0
answers
64
views
Extremely slow DB insert using Turbodbc
I have built Turbodbc 5.1.2 from source with simdutf 7.3.0, Python 3.11. When trying to insert 150,000 rows of 46 columns to a MySQL 8.0 InnoDB table, Turbodb takes about 190s, compared to 15s with my ...
1
vote
1
answer
121
views
Apache Doris INSERT INTO ... SELECT ... query is unexpectedly slow - how to troubleshoot?
I am experiencing performance issues with an
INSERT INTO target_table
SELECT ...
FROM source_table
[WHERE ...]
[GROUP BY ...]
query in my Apache Doris cluster (version 2.0.8).
The SELECT part of the ...
-3
votes
1
answer
54
views
error 1046 in subquery inserting data from specific columns to another table [closed]
I am trying to copy a few fields of video information from one MariaDB table to another using a subquery, decoupling some video info from a classified ads table for later refactoring.
video:
id (int ...
-4
votes
1
answer
66
views
INSERT multiple rows from SELECT returns error "This is not permitted" [closed]
I have two tables of same structure and want to insert rows from tableA into tableB.
The following example works fine:
INSERT INTO tableA (uniqueColA, colB, colC)
SELECT uniqueColA, colB, colC ...
-1
votes
2
answers
97
views
Sqlite3, how to make an INSERT statement inside a SELECT query?
I want to do, in exactly one sqlite3 query, an operation that :
Checks for the existence of a value in my table (call it V), written in a row indexed by A
If V exists and is equal to V_Param (...
-1
votes
1
answer
43
views
INSERT INTO after WITH statement in MySQL [duplicate]
I have no idea why I can't use an INSERT INTO combined with an WITH statement:
drop table if exists testdb.with_insert_into;
create table testdb.with_insert_into (id int);
with test_data as
(select 3 ...
-1
votes
2
answers
149
views
Why does my code give a syntax error on insert?
For my Delphi app with an SQLite database I am using TFDQuery, TFDConnection, TDataSource and TDBGrid components. All fields except AllKeys are VARCHAR. AllKeys is TEXT. Everything is connected ...
0
votes
1
answer
81
views
Rows inserted in Oracle procedure not available until after the procedure completes
I have a recursive procedure in a package in Oracle that traverses through a network. The recursive function runs down the network from the top and then returns values back up as the recursions close. ...
0
votes
0
answers
97
views
Airflow Error: Issues Inserting Data into Database Due to Transaction Abortion
I'm using Apache Airflow to automate the process of loading data into a PostgreSQL database. My workflow consists of multiple tasks where I fetch customer and order data via API, insert or update ...
0
votes
2
answers
162
views
SQL Oracle adding new rows to CTE
I'm trying to add addition rows to a CTE table using Oracle SQL and I can't quite get it to work. I've read up and it appears using INSERT INTO () is my best option, but I feel I am missing something ...
0
votes
0
answers
49
views
Why is ON CONFLICT DO UPDATE not working with PostgreSQL column aliasing?
I'm trying to perform an INSERT operation with an ON CONFLICT DO UPDATE clause in PostgreSQL. My table contains column names with aliases (e.g., "ITEM_CODE(material_code)"), and I want to ...
0
votes
1
answer
73
views
ORA-00001: uniqueness constraint violated
I have this procedure:
declare
datafix_id$c varchar2(100) := 'BSS-39038';
datafix_version$c varchar2(100) := '1.0';
description$c varchar(100) := 'BSS-39038 [CBM] Добавить ERT_SERVICE_ID на ...
1
vote
1
answer
74
views
Oracle SQL Error ORA-01756 when inserting a string pattern in Jenkins, but works in IntelliJ IDEA Database Tool
I'm trying to insert a pattern string into the PATTERN_SETTING table in Oracle using the following SQL:
INSERT INTO PATTERN_SETTING (ID, NAME, PATTERN)
VALUES (30, 'Alphanumeric and symbol', '^[a-zA-...
0
votes
0
answers
74
views
Postgres guard column function Insert statements
I am making columns immutable using BEFORE triggers and my current function works fine to protect columns from UPDATE, but I am having some trouble with INSERT.
Basically the problem is that my ...
4
votes
2
answers
128
views
Create rows of data into table that do not have a specific column value
I have a table that has missing information that needs to be inserted with very specific conditions. However, I am unsure on how to proceed.
I have one table that contains an overall view of ...
0
votes
1
answer
118
views
INSERT INTO SQL Server table errors: The supplied value is not a valid instance of data type float [duplicate]
I have a Pandas df I created from reading an email attachment. When inserting into a SQL Server table I see the following error for Parameter 6 which is Call Length column:
Parameter 6 (""):...
0
votes
1
answer
43
views
Spark InsertInto Slow Renaming in AWS S3
When using insertInto in AWS s3, the data is initially written to the .spark-staging folder and then moved (fake renaming) to the actual location in batches of 10 files at a time. Moving staging data ...
0
votes
0
answers
73
views
Powershell array of strings into single SQL column
I've this array of strings:
$qLastSS_T
2024-07-08 11:56:32
2024-08-08 12:56:32
2024-09-08 13:56:32
2024-10-08 13:56:32
2024-11-08 15:56:32
2024-12-08 16:56:32
and a SQL table like this:
Is it ...
0
votes
1
answer
52
views
SQL - insert rows preserving overall number of duplicate values
I have a table, say, Product (Id, Name):
Id
Name
1
'one'
2
'two'
3
'three'
I have a new version of data that is needed to update the table, with possible duplicate values.
For example:
Name
'one'
'two'...
-1
votes
1
answer
89
views
Insert with values from existing table
I need to move some values based on expiration date, but unfortunately because the tables are not one to one in number of records I receive an error message when my query is run. I need SQL to be able ...
1
vote
0
answers
35
views
Does it make a difference if a CTE comes before or after an insert?
insert statements in postgres can use CTEs ("with" expressions). These can come either before or after the insert itself. Is there any difference between one style vs the other?
For example, ...
-1
votes
2
answers
123
views
How to use try-catch in trigger
I want to prevent inserting data into a table and return 'Error' if 'OrderDate' column is greater than '2021-01-01'. How can I do this by the use of TRIGGER and TRY...CATCH in sql-server v.2019
...