Snowflake – 语法错误:意外的’‘。查询大小限制?

huangapple go评论64阅读模式
英文:

SNowflake - Syntax error: unexpected '<EOF>'. Query size limit?

问题

您遇到的问题可能与过程中的字符数限制有关。尝试通过删除注释来增加列数可能有效,因为注释会增加字符数。您可以尝试优化您的代码以减少字符数,或者查看您使用的数据库管理系统是否有字符数限制的文档,以了解更多关于限制的信息。

不过,请注意,对于复杂的存储过程,过多的列可能会使代码难以维护和理解。在添加大量列之前,最好考虑是否可以重新设计数据库模式,以更好地满足您的需求。

如果您需要进一步的帮助或解决方案,请提供更多信息,我将尽力提供支持。

英文:

I have a procedure and I want to modify this. When I use this request:

CREATE OR REPLACE PROCEDURE import_stage_sfr_ac_reeng_fixe_handicall_bordeaux(p_loading_mode VARCHAR)
RETURNS VARCHAR NOT NULL
LANGUAGE SQL
AS
BEGIN
 
	IF (:p_loading_mode =&#39;incremental&#39;) THEN
        COPY INTO SFR_AC_REENG_FIXE_HANDICALL_BORDEAUX (
        	V_NUM_COMMANDE_MIG,
        	V_SITE_CMD,
        	V_ACTIVITE_EZY,
        	V_TYPE_AC,
            D_JOUR_CMD,
            D_JOUR_PANIER,
            V_SEMAINE_CMD,
            V_MOIS_CMD,
            V_LOGIN_CC_CMD,
            V_NUM_CONTRAT,
 
            V_TYPE_ACTE,
            B_MIG,
            V_COURANT_PTA_MIG,
            V_LIBL_COURANT_PTA_MIG,
            V_FUTUR_PTA_MIG,
            V_LIBL_FUTUR_PTA_MIG,
            V_LIBL_FUTUR_PTA_MIG_COURT,
            B_REMISE,
            V_LIBL_REMISE,
            N_MT_REMISE_M_TTC,
 
            B_USAGE,
            V_LIBL_USAGE,
            V_NOM,
            V_PRENOM,
            N_FACIAL_AVANT,
            N_FACIAL_APRES,
            N_REMISE_AVANT,
            N_REMISE_APRES,
            N_MOUVEMENT_VALEUR,
            V_CODE_CAMPAGNE,
            
            B_FLAG_HBD,
            V_CODE_CAMPAGNE,
            V_CODE_LOT,
            V_RAC,
            
            V_TECH_NOM_FICHIER,
            V_TECH_STATUT_TRAITEMENT,
            V_TECH_NOM_TRAITEMENT,
            TS_TECH_DEBUT_TRAITEMENT
        ) FROM ( 
        SELECT
        	$12,
	        $1,
	        $2,
	        $3,
	        TO_DATE($4, &#39;YYYY-MM-DD&#39;),
	        TO_DATE($5, &#39;YYYY-MM-DD&#39;),
	        $6,
	        $7,
	        $8,
	        $9,
 
	        $10,
	        CAST($11 AS BOOLEAN),
	        $13,
	        $14,
	        $15,
	        $16,
	        $17,
	        CAST($18 AS BOOLEAN),
	        $19,
	        CAST($20 AS NUMBER(10, 0)),
            
	        CAST($21 AS BOOLEAN),
	        $22,
	        $23,
	        $24,
	        CAST(REPLACE($25, &#39;,&#39;, &#39;.&#39;) AS NUMBER(6, 3)),
        	CAST(REPLACE($26, &#39;,&#39;, &#39;.&#39;) AS NUMBER(6, 3)),
        	CAST(REPLACE($27, &#39;,&#39;, &#39;.&#39;) AS NUMBER(4, 2)),
        	CAST(REPLACE($28, &#39;,&#39;, &#39;.&#39;) AS NUMBER(4, 2)),
	        CAST(REPLACE($29, &#39;,&#39;, &#39;.&#39;) AS NUMBER(6, 3)),
            $30,
 
	        TO_BOOLEAN($31),
	        $32,
	        $33,
	        $34,
            
        	METADATA$FILENAME,
        	&#39;I&#39;,
        	&#39;INGEST MODE : &#39;|| :p_loading_mode,
        	current_timestamp(0)
        FROM  @ES_SFR )
        FILE_FORMAT  = ( FORMAT_NAME  = FF_INGEST_CSV_SFR)
        PATTERN  =  &#39;.*incremental.*ac_reeng_fixe_handicall_bordeaux.*\.csv&#39;;
	END IF;

It work. But if I add just a column, I have the message Syntax error: unexpected &#39;&lt;EOF&gt;&#39;. no matter the column.

Example:

CREATE OR REPLACE PROCEDURE import_stage_sfr_ac_reeng_fixe_handicall_bordeaux(p_loading_mode VARCHAR)
RETURNS VARCHAR NOT NULL
LANGUAGE SQL
AS
BEGIN
 
	IF (:p_loading_mode =&#39;incremental&#39;) THEN
        COPY INTO SFR_AC_REENG_FIXE_HANDICALL_BORDEAUX (
        	V_NUM_COMMANDE_MIG,
        	V_SITE_CMD,
        	V_ACTIVITE_EZY,
        	V_TYPE_AC,
            D_JOUR_CMD,
            D_JOUR_PANIER,
            V_SEMAINE_CMD,
            V_MOIS_CMD,
            V_LOGIN_CC_CMD,
            V_NUM_CONTRAT,
 
            V_TYPE_ACTE,
            B_MIG,
            V_COURANT_PTA_MIG,
            V_LIBL_COURANT_PTA_MIG,
            V_FUTUR_PTA_MIG,
            V_LIBL_FUTUR_PTA_MIG,
            V_LIBL_FUTUR_PTA_MIG_COURT,
            B_REMISE,
            V_LIBL_REMISE,
            N_MT_REMISE_M_TTC,
 
            B_USAGE,
            V_LIBL_USAGE,
            V_NOM,
            V_PRENOM,
            N_FACIAL_AVANT,
            N_FACIAL_APRES,
            N_REMISE_AVANT,
            N_REMISE_APRES,
            N_MOUVEMENT_VALEUR,
            V_CODE_CAMPAGNE,
            
            B_FLAG_HBD,
            V_CODE_CAMPAGNE,
            V_CODE_LOT,
            V_RAC,
            V_PROMO_TR,
            
            V_TECH_NOM_FICHIER,
            V_TECH_STATUT_TRAITEMENT,
            V_TECH_NOM_TRAITEMENT,
            TS_TECH_DEBUT_TRAITEMENT
        ) FROM ( 
        SELECT
        	$12,
	        $1,
	        $2,
	        $3,
	        TO_DATE($4, &#39;YYYY-MM-DD&#39;),
	        TO_DATE($5, &#39;YYYY-MM-DD&#39;),
	        $6,
	        $7,
	        $8,
	        $9,
 
	        $10,
	        CAST($11 AS BOOLEAN),
	        $13,
	        $14,
	        $15,
	        $16,
	        $17,
	        CAST($18 AS BOOLEAN),
	        $19,
	        CAST($20 AS NUMBER(10, 0)),
            
	        CAST($21 AS BOOLEAN),
	        $22,
	        $23,
	        $24,
	        CAST(REPLACE($25, &#39;,&#39;, &#39;.&#39;) AS NUMBER(6, 3)),
        	CAST(REPLACE($26, &#39;,&#39;, &#39;.&#39;) AS NUMBER(6, 3)),
        	CAST(REPLACE($27, &#39;,&#39;, &#39;.&#39;) AS NUMBER(4, 2)),
        	CAST(REPLACE($28, &#39;,&#39;, &#39;.&#39;) AS NUMBER(4, 2)),
	        CAST(REPLACE($29, &#39;,&#39;, &#39;.&#39;) AS NUMBER(6, 3)),
            $30,
 
	        TO_BOOLEAN($31),
	        $32,
	        $33,
	        $34,
            $35,
            
        	METADATA$FILENAME,
        	&#39;I&#39;,
        	&#39;INGEST MODE : &#39;|| :p_loading_mode,
        	current_timestamp(0)
        FROM  @ES_SFR )
        FILE_FORMAT  = ( FORMAT_NAME  = FF_INGEST_CSV_SFR)
        PATTERN  =  &#39;.*incremental.*ac_reeng_fixe_handicall_bordeaux.*\.csv&#39;;
	END IF;

I search since this morning, I was able to add more column by deleting the comments. I therefore really wonder if this is not a limitation of the number of characters in the procedure. Any idea ?

Thanks

答案1

得分: 1

要解决问题,您需要在代码块周围添加$$符号进行引用。

示例:

CREATE OR REPLACE PROCEDURE import_stage_sfr_ac_reeng_fixe_handicall_bordeaux(p_loading_mode VARCHAR)
RETURNS VARCHAR NOT NULL
LANGUAGE SQL
AS
$$
BEGIN
--您的代码脚本块
END
$$;

文档参考。

英文:

To fix the issue you need to add the $$ sings to quote the code block.

Example:

CREATE OR REPLACE PROCEDURE import_stage_sfr_ac_reeng_fixe_handicall_bordeaux(p_loading_mode VARCHAR)
RETURNS VARCHAR NOT NULL
LANGUAGE SQL
AS
$$
BEGIN
--your code the scripting block
END
$$;

Doc reference.

huangapple
  • 本文由 发表于 2023年5月17日 20:51:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76272324.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定