【问题标题】:In Postgres i am trying to return the value but it shows a error在 Postgres 我试图返回值,但它显示错误
【发布时间】:2014-11-20 07:56:40
【问题描述】:

在 postgres 中我试图返回它,但它显示一个错误

select substr('10111',3,1) as aa_code
return aa_code;


ERROR:  syntax error at or near "return"
LINE 2:  return aa_code;
         ^
********** Error **********

【问题讨论】:

  • 请向我们展示您存储函数的完整源代码(return 仅在 PL/pgSQL 函数中有效)。

标签: postgresql-9.1


【解决方案1】:

为什么要使用 return?

=# select substr('10111',3,1) as aa_code;
 aa_code
---------
 1
(1 row)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-02-25
    • 2018-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多