如何在值语句中使用 select 语句 [英] How to use select statement in a value statement

查看:73
本文介绍了如何在值语句中使用 select 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我的代码有什么问题.日志说选择有一个我在下面复制的语法错误.我该如何解决这个问题?

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?

语法错误,需要以下内容之一:带引号的字符串、数字常量、日期时间常量、缺失值、+、-、MISSING、NULL、USER.

"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;

推荐答案

这应该是:

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;

在您原来的 VALUES 子句中,您只能使用常量.

In your original VALUES clause you can only use constants.

这篇关于如何在值语句中使用 select 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆