oracle – 是否有可能获得变量的最大可能长度
发布时间:2021-05-16 03:04:06 所属栏目:百科 来源:网络整理
导读:副标题#e# 我想知道在plsql中是否存在给出变量最大长度的函数. 例如,如果我声明 DECLAREvaria VARCHAR2(7)BEGIN call of a function that would return 7END 即使varia为null,我也可以得到varchar的长度为7. —例如 create or replace TYPE ENREG_320_03 UN
副标题[/!--empirenews.page--]
我想知道在plsql中是否存在给出变量最大长度的函数. 例如,如果我声明 DECLARE varia VARCHAR2(7) BEGIN call of a function that would return 7 END 即使varia为null,我也可以得到varchar的长度为7. —例如 create or replace TYPE ENREG_320_03 UNDER ENREG_320_BASE( date_creation VARCHAR2(8),raison_sociale_emetteur VARCHAR2(35),adresse_emetteur_1 VARCHAR2(35),adresse_emetteur_2 VARCHAR2(35),adresse_emetteur_3 VARCHAR2(35),num_siret VARCHAR2(14),ref_remise VARCHAR2(16),code_bic_emetteur VARCHAR2(11),type_ident_compte_debit VARCHAR2(1),ident_compte_debit VARCHAR2(34),code_devise_compte_debit VARCHAR2(3),ident_client VARCHAR2(16),type_ident_compte_frais VARCHAR2(1),ident_compte_frais VARCHAR2(34),code_devise_compte_frais VARCHAR2(3),zone_reserve VARCHAR2(16),indice_type_debit_remise VARCHAR2(1),indice_type_remise VARCHAR2(1),date_execution_souhait VARCHAR2(8),devise_transfert VARCHAR2(3),MEMBER FUNCTION get_date_creation RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.date_creation IS NULL THEN lpad(' ',8,' ') ELSE rpad(SELF.date_creation,' ') END; END get_date_creation; MEMBER FUNCTION get_raison_sociale_emetteur RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.raison_sociale_emetteur IS NULL THEN lpad(' ',35,' ') ELSE rpad(SELF.raison_sociale_emetteur,' ') END; END get_raison_sociale_emetteur; MEMBER FUNCTION get_adresse_emetteur_1 RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.adresse_emetteur_1 IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.adresse_emetteur_1,' ') END; END get_adresse_emetteur_1; MEMBER FUNCTION get_adresse_emetteur_2 RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.adresse_emetteur_2 IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.adresse_emetteur_2,' ') END; END get_adresse_emetteur_2; MEMBER FUNCTION get_adresse_emetteur_3 RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.adresse_emetteur_3 IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.adresse_emetteur_3,' ') END; END get_adresse_emetteur_3; MEMBER FUNCTION get_num_siret RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.num_siret IS NULL THEN lpad(' ',14,' ') ELSE rpad(SELF.num_siret,' ') END; END get_num_siret; MEMBER FUNCTION get_ref_remise RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.ref_remise IS NULL THEN lpad(' ',16,' ') ELSE rpad(SELF.ref_remise,' ') END; END get_ref_remise; MEMBER FUNCTION get_code_bic_emetteur RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.code_bic_emetteur IS NULL THEN lpad(' ',11,' ') ELSE rpad(SELF.code_bic_emetteur,' ') END; END get_code_bic_emetteur; MEMBER FUNCTION get_type_ident_compte_debit RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.type_ident_compte_debit IS NULL THEN lpad(' ',1,' ') ELSE rpad(SELF.type_ident_compte_debit,' ') END; END get_type_ident_compte_debit; MEMBER FUNCTION get_ident_compte_debit RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.ident_compte_debit IS NULL THEN lpad(' ',34,' ') ELSE rpad(SELF.ident_compte_debit,' ') END; END get_ident_compte_debit; MEMBER FUNCTION get_code_devise_compte_debit RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.code_devise_compte_debit IS NULL THEN lpad(' ',3,' ') ELSE rpad(SELF.code_devise_compte_debit,' ') END; END get_code_devise_compte_debit; MEMBER FUNCTION get_ident_client RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.ident_client IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.ident_client,' ') END; END get_ident_client; MEMBER FUNCTION get_type_ident_compte_frais RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.type_ident_compte_frais IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.type_ident_compte_frais,' ') END; END get_type_ident_compte_frais; MEMBER FUNCTION get_ident_compte_frais RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.ident_compte_frais IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.ident_compte_frais,' ') END; END get_ident_compte_frais; MEMBER FUNCTION get_code_devise_compte_frais RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.code_devise_compte_frais IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.code_devise_compte_frais,' ') END; END get_code_devise_compte_frais; MEMBER FUNCTION get_zone_reserve RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.zone_reserve IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.zone_reserve,' ') END; END get_zone_reserve; MEMBER FUNCTION get_indice_type_debit_remise RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.indice_type_debit_remise IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.indice_type_debit_remise,' ') END; END get_indice_type_debit_remise; MEMBER FUNCTION get_indice_type_remise RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.indice_type_remise IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.indice_type_remise,' ') END; END get_indice_type_remise; MEMBER FUNCTION get_date_execution_souhait RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.date_execution_souhait IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.date_execution_souhait,' ') END; END get_date_execution_souhait; MEMBER FUNCTION get_devise_transfert RETURN VARCHAR2 AS BEGIN RETURN CASE WHEN SELF.devise_transfert IS NULL THEN lpad(' ',' ') ELSE rpad(SELF.devise_transfert,' ') END; END get_devise_transfert; 所以我想知道是否存在一个简单的函数来获得字段的大小所以我不必在getter中使用数字:如果字段的大小改变了,就没有必要更改getter,它会工作无论varchar的大小 但我明白这是不可能的 (编辑:汉中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐