![](/img/trans.png)
[英]Insert data from android app into Oracle SQL table then take auto generated id and insert that into another table
[英]Insert data from a table into another with auto-generated ID
我有一個ASSET
表,它有一個屬性ASSET_ID
,它是通過sequence
生成的唯一 ID。 我可以插入一行
insert into ASSET (id, name)
values (default, "john")
我所有的“名稱”都存儲在另一個名為 staging 的表中,因此我將執行類似下面的操作,其中我將默認參數賦予第一個字段,並將暫存表的內容賦予名稱。
insert into ASSET (id, name)
values (
default,
select * from STAGING)
我怎樣才能做到這一點?
只需將id
排除在語句之外並使用insert. . . select
insert. . . select
insert. . . select
:
insert into asset (name)
select name
from staging;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.