2016-05-10 83 views
0

我想在oracle中使用toad插入多個數據,但不是沒有顯示錯誤消息,也沒有數據插入到上述表中。在oracle 10g表中使用toad插入多行數據10.5

INSERT ALL 
     INTO nratuser (username, password) VALUES ('alahalia','alahalia') 
     INTO nratuser (username, password) VALUES ('alamudi','alamudi'), 
     INTO nratuser (username, password) VALUES ('albilad','albilad'), 
     INTO nratuser (username, password) VALUES ('aldar','aldar'), 
     INTO nratuser (username, password) VALUES ('alfalah','alfalah'), 
     INTO nratuser (username, password) VALUES ('almona','almona'), 
     INTO nratuser (username, password) VALUES ('ansari','ansari'), 
     INTO nratuser (username, password) VALUES ('ansari_eft','ansari_eft'), 
     INTO nratuser (username, password) VALUES ('bahfinance','bahfinance'), 
     INTO nratuser (username, password) VALUES ('bec','bec'), 
     INTO nratuser (username, password) VALUES ('bfc','bfc'), 
     INTO nratuser (username, password) VALUES ('city_int','city_int'), 
     INTO nratuser (username, password) VALUES ('city_spot','city_spot'), 
     INTO nratuser (username, password) VALUES ('dlc','dlc'), 
     INTO nratuser (username, password) VALUES ('gulf','gulf'), 
     INTO nratuser (username, password) VALUES ('habib','habib'), 
     INTO nratuser (username, password) VALUES ('ime','ime'), 
     INTO nratuser (username, password) VALUES ('imespot','imespot'), 
     INTO nratuser (username, password) VALUES ('kbi','kbi'), 
     INTO nratuser (username, password) VALUES ('modern','modern'), 
     INTO nratuser (username, password) VALUES ('mullah','mullah'), 
     INTO nratuser (username, password) VALUES ('muscat','muscat'), 
     INTO nratuser (username, password) VALUES ('muzaini','muzaini'), 
     INTO nratuser (username, password) VALUES ('nonoo','nonoo'), 
     INTO nratuser (username, password) VALUES ('oman','oman'), 
     INTO nratuser (username, password) VALUES ('oman_int','oman_int'), 
     INTO nratuser (username, password) VALUES ('oman_uae','oman_uae'), 
     INTO nratuser (username, password) VALUES ('prabhu','prabhu'), 
     INTO nratuser (username, password) VALUES ('prime','prime'), 
     INTO nratuser (username, password) VALUES ('rastamani','rastamani'), 
     INTO nratuser (username, password) VALUES ('tfr','tfr'), 
     INTO nratuser (username, password) VALUES ('tfr_spot','tfr_spot'), 
     INTO nratuser (username, password) VALUES ('uae','uae'), 
     INTO nratuser (username, password) VALUES ('uae_dubai','uae_dubai'), 
     INTO nratuser (username, password) VALUES ('uaekuwait','uaekuwait'), 
     INTO nratuser (username, password) VALUES ('wall','wall'), 
     INTO nratuser (username, password) VALUES ('western','western'), 
     INTO nratuser (username, password) VALUES ('xpressmoney','xpressmoney'), 
     INTO nratuser (username, password) VALUES ('zenj','zenj'), 
     INTO nratuser (username, password) VALUES ('zenj_spot','zenj_spot'); 

SELECT * FROM DUAL; 

回答

1

您必須刪除SELECT之前分號和各INTO條款後的逗號:

SQL> INSERT ALL 
    2   INTO nratuser (username, password) VALUES ('alahalia','alahalia') 
    3   INTO nratuser (username, password) VALUES ('alamudi','alamudi') 
    4   INTO nratuser (username, password) VALUES ('albilad','albilad') 
    5   INTO nratuser (username, password) VALUES ('aldar','aldar') 
    6   INTO nratuser (username, password) VALUES ('alfalah','alfalah') 
    7   INTO nratuser (username, password) VALUES ('almona','almona') 
    8   INTO nratuser (username, password) VALUES ('ansari','ansari') 
    9   INTO nratuser (username, password) VALUES ('ansari_eft','ansari_eft') 
10   INTO nratuser (username, password) VALUES ('bahfinance','bahfinance') 
11   INTO nratuser (username, password) VALUES ('bec','bec') 
12   INTO nratuser (username, password) VALUES ('bfc','bfc') 
13   INTO nratuser (username, password) VALUES ('city_int','city_int') 
14   INTO nratuser (username, password) VALUES ('city_spot','city_spot') 
15   INTO nratuser (username, password) VALUES ('dlc','dlc') 
16   INTO nratuser (username, password) VALUES ('gulf','gulf') 
17   INTO nratuser (username, password) VALUES ('habib','habib') 
18   INTO nratuser (username, password) VALUES ('ime','ime') 
19   INTO nratuser (username, password) VALUES ('imespot','imespot') 
20   INTO nratuser (username, password) VALUES ('kbi','kbi') 
21   INTO nratuser (username, password) VALUES ('modern','modern') 
22   INTO nratuser (username, password) VALUES ('mullah','mullah') 
23   INTO nratuser (username, password) VALUES ('muscat','muscat') 
24   INTO nratuser (username, password) VALUES ('muzaini','muzaini') 
25   INTO nratuser (username, password) VALUES ('nonoo','nonoo') 
26   INTO nratuser (username, password) VALUES ('oman','oman') 
27   INTO nratuser (username, password) VALUES ('oman_int','oman_int') 
28   INTO nratuser (username, password) VALUES ('oman_uae','oman_uae') 
29   INTO nratuser (username, password) VALUES ('prabhu','prabhu') 
30   INTO nratuser (username, password) VALUES ('prime','prime') 
31   INTO nratuser (username, password) VALUES ('rastamani','rastamani') 
32   INTO nratuser (username, password) VALUES ('tfr','tfr') 
33   INTO nratuser (username, password) VALUES ('tfr_spot','tfr_spot') 
34   INTO nratuser (username, password) VALUES ('uae','uae') 
35   INTO nratuser (username, password) VALUES ('uae_dubai','uae_dubai') 
36   INTO nratuser (username, password) VALUES ('uaekuwait','uaekuwait') 
37   INTO nratuser (username, password) VALUES ('wall','wall') 
38   INTO nratuser (username, password) VALUES ('western','western') 
39   INTO nratuser (username, password) VALUES ('xpressmoney','xpressmoney') 
40   INTO nratuser (username, password) VALUES ('zenj','zenj') 
41   INTO nratuser (username, password) VALUES ('zenj_spot','zenj_spot') 
42 SELECT * FROM DUAL; 

40 rows created. 

SQL> 
SQL> select count(1) 
    2 from nratuser; 

    COUNT(1) 
---------- 
     40 

SQL> 
+0

感謝您的答案,但我失敗了。我將此代碼粘貼到蟾蜍編輯器中,然後執行。但數據沒有插入表 – Firefog

+0

你有沒有提交?我剛剛嘗試過(編輯我的答案),這工作 – Aleksej

+0

哦是的,我需要承諾 – Firefog

1

你不需要comma在每一行的末尾。在最後insert結束時刪除semicolon。使用這個

INSERT ALL 
    INTO nratuser (username, password) VALUES ('alahalia','alahalia') 
    INTO nratuser (username, password) VALUES ('alamudi','alamudi') 
    INTO nratuser (username, password) VALUES ('albilad','albilad') 
    INTO nratuser (username, password) VALUES ('aldar','aldar') 
    INTO nratuser (username, password) VALUES ('alfalah','alfalah') 
    INTO nratuser (username, password) VALUES ('almona','almona') 
    INTO nratuser (username, password) VALUES ('ansari','ansari') 
    INTO nratuser (username, password) VALUES ('ansari_eft','ansari_eft') 
    INTO nratuser (username, password) VALUES ('bahfinance','bahfinance') 
    INTO nratuser (username, password) VALUES ('bec','bec') 
    INTO nratuser (username, password) VALUES ('bfc','bfc') 
    INTO nratuser (username, password) VALUES ('city_int','city_int') 
    INTO nratuser (username, password) VALUES ('city_spot','city_spot') 
    INTO nratuser (username, password) VALUES ('dlc','dlc') 
    INTO nratuser (username, password) VALUES ('gulf','gulf') 
    INTO nratuser (username, password) VALUES ('habib','habib') 
    INTO nratuser (username, password) VALUES ('ime','ime') 
    INTO nratuser (username, password) VALUES ('imespot','imespot') 
    INTO nratuser (username, password) VALUES ('kbi','kbi') 
    INTO nratuser (username, password) VALUES ('modern','modern') 
    INTO nratuser (username, password) VALUES ('mullah','mullah') 
    INTO nratuser (username, password) VALUES ('muscat','muscat') 
    INTO nratuser (username, password) VALUES ('muzaini','muzaini') 
    INTO nratuser (username, password) VALUES ('nonoo','nonoo') 
    INTO nratuser (username, password) VALUES ('oman','oman') 
    INTO nratuser (username, password) VALUES ('oman_int','oman_int') 
    INTO nratuser (username, password) VALUES ('oman_uae','oman_uae') 
    INTO nratuser (username, password) VALUES ('prabhu','prabhu') 
    INTO nratuser (username, password) VALUES ('prime','prime') 
    INTO nratuser (username, password) VALUES ('rastamani','rastamani') 
    INTO nratuser (username, password) VALUES ('tfr','tfr') 
    INTO nratuser (username, password) VALUES ('tfr_spot','tfr_spot') 
    INTO nratuser (username, password) VALUES ('uae','uae') 
    INTO nratuser (username, password) VALUES ('uae_dubai','uae_dubai') 
    INTO nratuser (username, password) VALUES ('uaekuwait','uaekuwait') 
    INTO nratuser (username, password) VALUES ('wall','wall') 
    INTO nratuser (username, password) VALUES ('western','western') 
    INTO nratuser (username, password) VALUES ('xpressmoney','xpressmoney') 
    INTO nratuser (username, password) VALUES ('zenj','zenj') 
    INTO nratuser (username, password) VALUES ('zenj_spot','zenj_spot') 

SELECT * FROM DUAL;