日期:2014-05-17  浏览次数:20775 次

PL/sqldevelp 调试报错
DECLARE
  /*Declare variables which will be used in SQL statement*/
  v_NewMajor VARCHAR(10) := 'History';
  v_FristName VARCHAR2(10) := 'Scott';
  v_LastName VARCHAR2(10) := 'Urman';

BEGIN
  /*Update the students table*/
  UPDATE XX_KJA_TEST_VSTUDENT  
  SET MAJOR = v_NewMajor
  WHERE FIRST_NAME = v_FristName AND LAST_NAME = v_LastName;
   
  IF SQL%NOTFOUND THEN 
  INSERT INTO XX_KJA_TEST_VSTUDENT(ID,FIRST_NAME,LAST_NAME,MAJOR)
  VALUES(||001||,v_FirstName,v_LastName,v_NewMajor);

 END IF;
 END;
   

ORA-06550: line 14,column 26;
Pl/SQL: ORA-00936 :missing expression
ORA-06550: line 13,column 8;
PL/SQL:SQL Statement ignored


------解决方案--------------------
VALUES(||001||, --这个啥东东啊 如果是字符,用单引号
------解决方案--------------------
SQL code

--下面这语句有问题,||001||错的,楼主是想转换成字符串?转字符可以用001||''
INSERT INTO XX_KJA_TEST_VSTUDENT
      (ID, FIRST_NAME, LAST_NAME, MAJOR)
    VALUES
      (|| 001 ||, v_FirstName, v_LastName, v_NewMajor);