CREATE OR REPLACE FUNCTION SUPPLIER (Tradename IN DRUG.Tradename%TYPE) RETURN VARCHAR2
IS
returnString VARCHAR2(32767);
BEGIN
returnString := lpad('*',32767,'*');
SELECT Formula,Pharname INTO returnString FROM DRUG
WHERE Tradename=Tradename;
RETURN returnString;
END;
/
当我尝试创建此功能时,它会说:
Warning : Function created with compilation errors.
当我执行“show err”时,我明白了:
LINE/COL ERROR
-------- -----------------------------------------------------------------
7/2 PL/SQL: SQL Statement ignored
7/44 PL/SQL: ORA-00947: not enough values
非常感谢任何帮助!
答案 0 :(得分:1)
ORA-00947“没有足够的价值”
正在第7行提出:
SELECT Formula,Pharname INTO returnString
您正在选择两列,但您只提供一个变量来放入它们。
您可以添加第二个变量,也可以使用某种表达式来连接值,例如:
SELECT Formula,Pharname INTO returnFormula,returnPharname
或
SELECT Formula || Pharname INTO returnString