简体   繁体   English

DB2 / 400 UDF中的区分大小写?

[英]Case sensitivity in DB2/400 UDF?

I am writing an SQL wrapper for a service program procedure. 我正在为服务程序过程编写一个SQL包装器。 The procedure works, but the UDF I am creating is behaving strangely. 该过程有效,但我正在创建的UDF表现得很奇怪。 When I create the UDF with the external name keyword, it is becoming case sensitive. 当我使用外部名称关键字创建UDF时,它变得区分大小写。 Here is the code I have: 这是我的代码:

create function C1ANEWF.getSalesAuditStorePeriodLibrary
                   (inStore decimal(5,0),
                    inDate  date)
returns char(10) ccsid 37

language rpgle
parameter style general
specific sa1802f001
not deterministic
reads sql data
returns null on null input
not fenced
program type sub
no final call
allow parallel
no scratchpad
external name C1NEWO.SA1802("getSalesAuditStorePeriodLibrary")

When I create this, it works. 当我创建它时,它的工作原理。 If I remove the "" from the procedure name, it does not. 如果我从过程名称中删除"" ,则不会。 I have lots of SQL UDFs where I am not using the "" , and case sensitivity is not an issue. 我有很多SQL UDF,我没有使用"" ,并且区分大小写不是问题。

Any ideas? 有任何想法吗?

Wrapping the subprocedure name in quotes tells DB2 to use the name exactly as quoted, that is, in mixed case. 将子过程名称包含在引号中会告诉DB2使用与引用完全相同的名称,即大小写混合。 If your call to this procedure only works when you register the function in mixed case, it seems that your call must also be using mixed case. 如果您对此过程的调用仅在以大小写混合的形式注册该函数时有效,则您的调用似乎也必须使用大小写混合。 Is the calling statement using double quotes? 调用语句是否使用双引号? If so, remove them there as well. 如果是这样,也将它们移除。

Display the procedure exports of your service program, with DSPSRVPGM ____ DETAIL(*PROCEXP) . 使用DSPSRVPGM ____ DETAIL(*PROCEXP)显示服务程序的过程导出。 You will see that the procedure name is mixed case. 您将看到过程名称是大小写混合的。 Now look at one of your older service programs. 现在看看你的一个旧服务程序。 You will see uppercase names. 您将看到大写名称。

The quotes your SQL make sure that mixed case is used, and thus match the procedure name, which is case sensitive. 引用SQL确保使用混合大小写,从而匹配过程名称,区分大小写。 Without those quotes, the name would be translated to uppercase, which would match your older procedures. 如果没有这些引号,名称将被翻译为大写,这将与您的旧程序相匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM