How to use select statement in a value statement

房东的猫 提交于 2019-12-25 02:57:31

问题


I'm not sure what's wrong with my code. The log is saying that the select has a syntax error which I copied below. How do I fix this?

"Syntax error, expecting one of the following: a quoted string, a numeric constant,a datetime constant, a missing value, +, -, MISSING, NULL, USER.

ERROR: Syntax error, statement will be ignored."

proc sql;
    insert into orion.test  (Fruits, Vegetables, Drinks, Meats)
        values (select a.fruit, a.veggie, a.drink, a.meat FROM work.meals AS a);
quit;

回答1:


This should be:

proc sql;
    insert into orion.test  (Fruits, Vegetables, Drinks, Meats)
        select a.fruit, a.veggie, a.drink, a.meat FROM work.meals AS a;
quit;

In your original VALUES clause you can only use constants.



来源:https://stackoverflow.com/questions/31145679/how-to-use-select-statement-in-a-value-statement

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!