Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to get the id from a sql query insert for use in foreign key relationships?#1966

Unanswered
mxc asked this question inQ&A
Discussion options

Hi all.

I have an insert query that returns the id of the inserted row:

insert into public.catalogue (c_id,delivery_method,name,code) values ({{frmCatalogueEntry.data.sltC}}::int,{{frmCatalogueEntry.data.sltDeliveryMethod}},
{{frmCatalogueEntry.data.txtName}},{{frmCatalogueEntry.data.txtCode}}) returning id

I try to access this in a query that is run "On Success"

insert into public.cost_price (catalogue_id,provider,active,created)
values({{insertCatalogueEntry.data.id}}, .....

But the {{insertCatalogueEntry.data.id}} is always null?

Also is there a way to wrap this all in a transaction so the queries commit or rollback on failure?

Thanks

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@mxc

[8]ページ先頭

©2009-2025 Movatter.jp