我正在为聊天机器人创建API

时间:2019-07-22 06:12:34

标签: sql

此代码可在sql命令提示符下工作,但在API中使用此代码时不会提供任何输出

const query = 'SELECT SUM (amount) SALE_AMOUNT FROM mv_mnth_sale  WHERE 1 = 1 AND (TO_DATE (MONTH || "-" || YEAR, "MON-yyyy")) BETWEEN ADD_MONTHS (TO_DATE (TO_CHAR (SYSDATE, "Mon-yyyy"), "Mon-yyyy" ),  -:no_of_months  ) AND LAST_DAY (ADD_MONTHS (TO_DATE (TO_CHAR (SYSDATE,"Mon-yyyy"),"Mon-yyyy" ),-1))';

                          const result = await database.simpleExecute(query,binds);
                          const sale_amount = result.rows[0].SALE_AMOUNT;

                            var data = { "sale_amount" : sale_amount }


const query = 'SELECT SUM (amount) SALE_AMOUNT FROM mv_mnth_sale  WHERE 1 = 1 AND (TO_DATE (MONTH || "-" || YEAR, "MON-yyyy")) BETWEEN ADD_MONTHS (TO_DATE (TO_CHAR (SYSDATE, "Mon-yyyy"), "Mon-yyyy" ),  -:no_of_months  ) AND LAST_DAY (ADD_MONTHS (TO_DATE (TO_CHAR (SYSDATE,"Mon-yyyy"),"Mon-yyyy" ),-1))';

                          const result = await database.simpleExecute(query,binds);
                          const sale_amount = result.rows[0].SALE_AMOUNT;

                            var data = { "sale_amount" : sale_amount }

0 个答案:

没有答案