简体   繁体   中英

Trying to run multiple SQL Scripts

I have been trying to run multiple SQL scripts within PL/SQL Developer. I have tried this with and without the '/' character, I am getting 'ORA-00911: invalid character". I have about 800 UPDATE statements that I need to correct spelling errors, punctuation and spacing.

Please let me know what I should do to get these to work.

Thank you

SELECT * 
  FROM LKUP_SPROJ_TYPE 
 WHERE DESCRIPTION IN ('Single-Family Residential');
 / 
 UPDATE LKUP_SPROJ_TYPE
   SET DESCRIPTION = 'Single - Family Residential'
 WHERE DESCRIPTION IN ('Single-Family Residential');
 / 
SELECT * 
  FROM LKUP_SPROJ_TYPE 
 WHERE DESCRIPTION IN ('Single - Family Residential');
 /

Have you tried enclosing the statements in a BEGIN... END block and removing the / and just keeping the ; s like so?

BEGIN 

  SELECT * 
  FROM LKUP_SPROJ_TYPE 
  WHERE DESCRIPTION IN ('Single-Family Residential');

  UPDATE LKUP_SPROJ_TYPE
  SET DESCRIPTION = 'Single - Family Residential'
  WHERE DESCRIPTION IN ('Single-Family Residential');

  SELECT * 
  FROM LKUP_SPROJ_TYPE 
  WHERE DESCRIPTION IN ('Single - Family Residential');

END;

I'm assuming you've got these statements in an SQL window in PL/SQL Developer. If so, get rid of the slashes, click somewhere inside each statement in turn, and press F8 to execute the statement. PL/SQL Developer doesn't use slashes to separate statements. Also, somewhere in the depths of the Options dialog there's a setting to have it execute all statements in a window - you can turn this on or off as you wish.

If you've got them in some other type of window (Test, etc) I suggest you copy them to an SQL window.

Share and enjoy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM