如何在 Teradata 中不带参数的 运行 过程

How to run procedure without parameter in Teradata

如何在 Teradata 中 运行 没有参数的过程 我正在尝试:call db1.proc_dbOSA()

错误消息:

Call failed 3707: PROC_DBOSA: Syntax error, expected something 
like a name or a Unicode delimited identifier between ‘(‘ and ‘)’

有错误结果的新程序。 当我 运行 只写代码时,一切正常。

REPLACE PROCEDURE db1.proc_dbOSA()
BEGIN
    DELETE FROM db1.LOG_dbOSA;      
INSERT INTO
    db1.LOG_dbOSA
        (StoreNo, IDX, Flow, Status, MRP, OSA_IDX, OSA_AC)

WITH a AS (
SELECT    
    c.StoreCode,
    CAST(SUBSTRING(c.ArticleCode FROM 13 FOR 6) AS INT) AS IDX,
    RpType,
    CASE
        WHEN  c.MinimumTargetStockWrpl >= l.MinimumTargetStockWrpl THEN CAST(l.MinimumTargetStockWrpl AS INT)
        WHEN  c.MinimumTargetStockWrpl <  l.MinimumTargetStockWrpl THEN CAST(c.MinimumTargetStockWrpl AS INT)
    End AS StoreMin,
    c.ValUnrestrictedStock
FROM 
   db1.tab1 c
INNER JOIN
    (
    SELECT    
        StoreCode,
        ArticleCode,
        MinimumTargetStockWrpl    
    FROM 
        db1.tab1
    WHERE
        ProcessingDate = CURRENT_DATE - 14
    ) l ON c.StoreCode = l.StoreCode AND c.ArticleCode = l.ArticleCode
WHERE
    c.ProcessingDate = CURRENT_DATE AND c.MinimumTargetStockWrpl IS NOT NULL AND l.MinimumTargetStockWrpl IS NOT NULL AND l.MinimumTargetStockWrpl > 0
)

, t AS
(
SELECT    
    CAST(SUBSTRING(ArticleCode FROM 13 FOR 6) AS INT) AS IDX,
    RpType, 
    ArticlesPlanner
FROM 
    DWH_db_V.STK_B_ARTICLE_DAY_V
WHERE 
    ProcessingDate = CURRENT_DATE AND StoreCode = 'DR04'
)

SELECT 
    a.StoreCode,
    a.IDX,
    t.RpType,
    t.ArticlesPlanner,
    a.RpType,
    CASE
        WHEN a.ValUnrestrictedStock > 0 THEN 1
        WHEN a.ValUnrestrictedStock <= 0 THEN 0
    End AS OSA_IDX,
    CASE
        WHEN a.ValUnrestrictedStock >= StoreMin THEN 1
        WHEN a.ValUnrestrictedStock < StoreMin THEN 0
    End AS OSA_AC
FROM 
    a
LEFT JOIN
    t ON t.IDX = a.IDX;     
End;

BTEQ 错误: +--------+--------+--------+--------+-------- +--------+--------+---- 调用 proc_dbOSA;

呼叫proc_dbOSA; $ * 失败 3707 语法错误,应在单词之间使用“(”之类的内容 'proc_dbOSA' 和 ';'。 语句# 1,信息 =18 * 总耗时为 1 秒。

调用proc_dbOSA(); * 失败 3707 PROC_DBOSA:Syntax 错误,需要类似名称或 '(' 和 ')' 之间的 Unicode 分隔标识符。 * 总耗时为 1 秒。

存储过程不支持以下内容:

EXPLAIN 和 USING 存储过程中的请求修饰符

执行宏语句

存储过程中的 WITH 子句。

存储过程和宏不支持以下查询日志语句:

开始查询记录

结束查询记录

刷新查询日志记录

替换查询日志记录