使用toad 10.5在oracle 10g表中插入多行数据

时间:2016-05-10 08:47:29

标签: oracle toad

我正在尝试使用toad在oracle中插入多个数据,但是没有显示错误消息,也没有数据插入到所述表中。

    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; 

2 个答案:

答案 0 :(得分: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>

答案 1 :(得分:1)

每行末尾都不需要comma。同时删除semicolon末尾的insert。使用此

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;