1
在sql中定義變量的最佳做法是什麼?我在這裏和其他地方看過一些其他的帖子,但是我嘗試過的東西還沒有成功。SQL:變量聲明
我使用下面的語法,但馬不喜歡乾草。
declare @variablename number(10) set @variablename = (select COLUMN_NAME from TABLE_NAME where ANOTHER_COLUMN_NAME='something') select MORE_COLUMN_NAMES from "NAME" where [email protected];
這給了我一些從「聲明」開始的錯誤。
Error report - ORA-06550: line 1, column 9: PLS-00103: Encountered the symbol "@" when expecting one of the following: begin function pragma procedure subtype type "an identifier" "a double-quoted delimited-identifier" current cursor delete exists prior The symbol "@" was ignored.
我剛開始的時候對於應用程序的東西只有很少的數據庫知識。我正在努力學習更多的語法和用法。
任何幫助,將不勝感激。
接受的在這篇文章中回答應該有所幫助http://stackoverflow.com/questions/11754781/how-to-declare-a-variable-in-mysql – grizzthedj
你有這個標籤爲MySQL和Oracle。你的問題涉及哪個數據庫? –
根據錯誤消息,我刪除了Mysql標記 – Aleksej