Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何在函数中调用函数_Sql_Oracle_Postgresql - Fatal编程技术网

Sql 如何在函数中调用函数

Sql 如何在函数中调用函数,sql,oracle,postgresql,Sql,Oracle,Postgresql,此函数基于Oracle PL/SQL函数: create or replace FUNCTION SP_ComputeEntity (P_ENTITY NUMERIC, P_CAMPAIGN NUMERIC, P_COMPLETE_IF NUMERIC, P_COMPUTE_MODE NUMERIC ) RETURNS VOID AS $$ DECLARE [..] -- This is the list of the entity's subordinates [..]

此函数基于Oracle PL/SQL函数:

  create or replace FUNCTION SP_ComputeEntity (P_ENTITY NUMERIC, P_CAMPAIGN  NUMERIC, P_COMPLETE_IF  NUMERIC, P_COMPUTE_MODE  NUMERIC ) RETURNS VOID AS $$
DECLARE
  [..]


-- This is the list of the entity's subordinates
  [..]

-- This is the list of the entity's questionnaires
 [..]

BEGIN

  -- If the entity must not be computed for this campaign stop
 [..]
  -- Check if already computed .
 [..]

  -- If not already computed compute it now .
  IF V_EXISTS = 0 THEN

    -- Loop on subordinates to check if already computed
    OPEN ENTITY_COLUMNS;
    LOOP
      FETCH ENTITY_COLUMNS INTO V_COLUMN_ID;
      EXIT WHEN ENTITY_COLUMNS%NOTFOUND;

      SP_ComputeEntity(V_COLUMN_ID, P_CAMPAIGN, P_COMPLETE_IF, P_COMPUTE_MODE);

    END LOOP;
    CLOSE ENTITY_COLUMNS;

    [..]
END;
$$
LANGUAGE plpgsql;
我的问题是pgAdmin III给了我 错误:“SP_Computentity”处或附近出现语法错误 SQL状态:42601 人物:1773
我不知道为什么。能做到吗?有人可以在postgresql中调用相同的函数吗?

执行SP\u计算过程,如

 SELECT SP_ComputeEntity(V_COLUMN_ID, P_CAMPAIGN, P_COMPLETE_IF, P_COMPUTE_MODE);

如果不需要查询结果,可以使用


您也可以像在变量中选择和检索结果一样使用函数

举个例子:

SELECT INTO myvar myres FROM myfunction(param1, param2);

体内的功能?谢谢你的帮助。成功了!谢谢你的帮助。成功了!
SELECT INTO myvar myres FROM myfunction(param1, param2);