您好我正在嘗試插入與此表類似的行
要插入表格,我使用此代碼
Insert Into Fixture_Data (Fixture_NAME, Date_Logged, Calendar_Week, Calendar_Year)
Select ACTIVE_FIXTURES.Fixture_NAME,
Fixture_Rows_For_Year.Start_Date as Date_Logged,
Fixture_Rows_For_Year.Calendar_Week,
Fixture_Rows_For_Year.Calendar_Year
From ACTIVE_FIXTURES
Cross Join Fixture_Rows_For_Year;
但是,當我想為一個專門為一個夾具名稱插入一行時,我得到一個錯誤。我要為其插入的夾具名稱來自另一個表,在該表中我保留了所有活動夾具的串列,但我得到一個SQL 命令未正確結束或并非所有變數都正確系結錯誤,具體取決于我放置 where 陳述句的位置。這是錯誤代碼:
Insert Into Fixture_Data (Fixture_NAME, Date_Logged, Calendar_Week, Calendar_Year)
Select ACTIVE_FIXTURES.Fixture_NAME,
Fixture_Rows_For_Year.Start_Date as Date_Logged,
Fixture_Rows_For_Year.Calendar_Week,
Fixture_Rows_For_Year.Calendar_Year
From ACTIVE_FIXTURES
Cross Join Fixture_Rows_For_Year
where Fixture_Name =: P6_NEW;
任何幫助是極大的贊賞。
uj5u.com熱心網友回復:
P6_NEW是位于第 6 頁上的專案(您可以將其命名為更聰明一點,“新”不是很具有描述性)。
參考頁面專案時,請在其名稱前加上冒號 ( :) 符號。它的意思就是——在專案名稱之前。中間沒有空格。
No : where Fixture_Name =: P6_NEW
Yes: where a.fixture_name = :P6_NEW
----
note the difference
另外,要習慣使用表別名;它們使代碼更易于閱讀。
insert into fixture_data
(fixture_name,
date_logged,
calendar_week,
calendar_year)
select a.fixture_name,
f.start_date as date_logged,
f.calendar_week,
f.calendar_year
from active_fixtures a cross join fixture_rows_for_year f
where a.fixture_name = :P6_NEW;
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/448753.html
標籤:sql 甲骨文 甲骨文顶点 oracle-apex-5.1
下一篇:如何根據報價集計算總和
