using meta-SQL 使用元SQL (3)

%FirstRows

Syntax

%FirstRows(n)

Description

The %FirstRows meta-SQL variable is replaced by database-specific SQL syntax to optimize retrieval of n rows. Depending on the database, this variable optimizes:

FirstRows meta-SQL变量被特定于数据库的SQL语法替换,以优化n行的检索。根据数据库的不同,此变量会优化:

  • The query path.
  • 查询的路径。
  • The number of rows returned.
  • 返回的行数。
  • The number of rows returned per fetch buffer.
  • 每个获取缓冲区返回的行数。

Considerations Using %FirstRows

使用% FirstRows的注意事项

Consider the following when using %FirstRows:

这意味着SQL针对平台支持的前n行进行了优化。可能会返回更多行,具体取决于平台。

  • Using %FirstRows does not mean only the first n rows are returned.
  • 使用%FirstRows并不意味着只返回前n行。

It means that the SQL is optimized for the first n rows where the platform supports it. More rows might be returned, depending on the platform.

这意味着SQL针对平台支持的前n行进行了优化。可能会返回更多行,具体取决于平台。

  • It is the application's responsibility to stop fetching when enough rows have been returned.
  • 当返回足够多的行时,应用程序有责任停止获取。
  • This meta-SQL variable is not implemented for COBOL or dynamic view SQL.
  • 这个元SQL变量不是为COBOL或动态视图SQL实现的。
  • Do not use this meta-SQL variable if the application might require more than n rows fetched.
  • 如果应用程序可能需要获取超过n个行,请不要使用这个元SQL变量。

The results of fetching more than n rows varies by platform. Some return the extra rows, but performance may be suboptimal. Others return the message "ROW NOT FOUND".

获取超过n行的结果因平台而异。有些返回额外的行,但性能可能不理想。其他人返回的消息“行未找到”。

  • Place this meta-SQL variable between the Select statement that begins the SQL statement and the Select List statement.
  • 将此meta-SQL变量放在SQL语句开始的Select语句和Select List语句之间。

Do not use it in subqueries, views, Insert/Select statements, and so on. Do not use a wildcard (*) with the Select List statement.

不要在子查询、视图、插入/选择语句等中使用它。不要使用通配符(*)与“选择列表”语句一起使用。

  • Do not use this meta-SQL variable with Distinct statements, because the code SELECT TOP 1 DISTINCT fails on Microsoft SQL Server.
  • 不要将此元SQL变量与Distinction语句一起使用,因为在微软SQL Server上,SELEC-OP 1-Distinction代码会失败。
  • This meta-SQL variable is implicitly embedded in all Select statements for SQLExecs for all platforms except Oracle.
  • 这个元SQL变量隐式地嵌入到除甲骨文以外的所有平台的SQLExecs的所有Select语句中。

Parameters

Parameter

Description

n

Specify the number of rows to optimize retrieval for.

指定要优化检索的行数

Example

The following code checks for the existence of a row:

下面的代码检查是否存在一行:

&SQL = CreateSQL("select %firstrows(1) 'x' from PS_EXAMPLE where COL1 = :1", &temp)⇒ ;

The following populates a 10-element array:

下面的代码填充一个包含10个元素的数组:

&SQL = CreateSQL("select %firstrows(10) COL2, COL3 from PS_EXAMPLE_VW where COL1 = ⇒

:1", &temp);

%GetProgText

Syntax

%GetProgText(&Prog,&Section,&Market,&Platform,&Effdt,&Step,&Event)

Description

The %GetProgText function returns a string with the text of a PeopleCode program uniquely identified by the parameters.

GetProgText函数返回一个字符串,其中包含由参数唯一标识的PeopleCode程序的文本。

Parameters

Parameter

Description

&Prog

A string with the name of an Application Engine program.

&Section

A string with the name of an Application Engine program section.

&Market

A string specifying the market for an Application Engine program section.

&Platform

A string specifying the platform for an Application Engine program section.

&Effdt

A string specifying the effective date for an Application Engine program section.

&Step

A string specifying a step in an Application Engine program section.

&Event

A string specifying the PeopleCode event.

Returns

A string containing the text of a PeopleCode program.

包含PeopleCode程序文本的字符串。

Example

&PeopleCodeText = GetProgText("DYNROLE_PUBL", "MAIN", "GBL", "default",

"1900-01-01", "Step03", "OnExecute");

Related Links

“Understanding the SQL Editor Window” (PeopleCode Developer’s Guide)

相关链接"了解SQL编辑器窗口"(PeopleCode开发人员指南)

%Insert

Syntax

%Insert(:num)

Description

This is a shorthand for:

这是一个简写:

Insert into %Table(:num) (%List(Nonnull_Fields :num)) values (%InsertValues(:num))

%InsertSelect

Syntax

%InsertSelect([DISTINCT, ]insert_recname, select_recname [ correlation_id] [, select_recname_n [ correlation_id_n]] [, override_field = value]. . .)

Description

The %InsertSelect meta-SQL construct generates an Insert statement with a Select statement. It does not generate a From statement. You must specify the select records before you specify override fields.

InsertSelect meta-SQL构造使用Select语句生成一个Insert语句。它不生成From语句。在指定覆盖字段之前,必须指定选择记录。

Note: %InsertSelect has a limit of 99 override fields.

注意:%InsertSelect有99个覆盖字段的限制。

The Insert column list is composed of all the fields in the specified insert_recname, with the exception of LongChar or Image fields.

Note: Because of the way long values (LongChar and Image fields) are handled in the various database platforms for Insert statements, all long values in insert_recname  are skipped in the generated Insert statement. This implies that these fields should be defined in such a manner as to allow null values. If you need to include long values in insert_recname  use %InsertSelectWithLongs.

The corresponding value in the Select list is generated based on the following precedence:

选择列表中的相应值将根据以下优先级生成:

  1. If the Insert fieldname appears as an override_field, the corresponding value is used in the Select list.

如果Insert字段名显示为override_field,则在Select列表中使用相应的值。

  1. If the Insert field name matches a field name in one of the select_recname variables specified, the corresponding Select field is used in the Select list.

如果Insert字段名与指定的select_recname变量中的某个字段名匹配,则在Select列表中使用相应的Select字段。

  1. The search order of the select_recname records is the order that they are specified in the %InsertSelect function.

select_recname记录的搜索顺序是在%InsertSelect函数中指定的顺序。

  1. If the Insert field name has a constant default value defined in Application Designer, that value is used in the Select list.

如果“插入”字段名具有在应用程序设计器中定义的常量默认值,则在“选择”列表中使用该值。

  1. A default value appropriate for the data type of the Insert field is used (blank for characters, zero for numbers, NULL for Date, Time, and DateTime values, and so on.)

使用与Insert字段的数据类型相适应的默认值(空格表示字符,0表示数字,NULL表示Date、Time和DateTime值,等等)。

Use the optional override_field variable to specify values for a particular field.

使用可选的override_field变量为特定字段指定值。

Note: You cannot use bind variables with the override_field.

注意:不能将绑定变量与override_field一起使用。

For each field you specify, the matching logic described in the preceding list is not performed. Instead, the value that you specify after the equal sign is used for that field in the actual Select list. Use this technique to let PeopleTools or Application Engine handle most of the fields in the record, while specifying some of them explicitly. Also, you can use override_field to specify aggregate functions like Sum, Max, and so on.

对于您指定的每个字段,不执行前面列表中描述的匹配逻辑。相反,在等号后面指定的值将用于实际的“选择”列表中的该字段。使用此技术可以让PeopleTools或应用程序引擎处理记录中的大多数字段,同时显式指定其中的一些字段。此外,还可以使用override_field指定聚合函数,如Sum、Max等。

Note: This meta-SQL is not implemented for COBOL.

注意:这个元SQL不是为COBOL实现的。


Parameters

Parameter

Description

DISTINCT

Specify if the Select statement being generated should contain a Distinct clause.

insert_recname

Specify the name of record being inserted into. You must specify a record name, not RECORD. recname, a record name in quotation marks, a bind variable, or a table name.

Note: If the record for insert_recname is a temporary table,  %InsertSelect automatically substitutes the corresponding table instance (PS_TARGETnn instead of PS_TARGET).

select_recname

Specify the name of record being selected from. You can specify more than one record. You must specify a record name,  not a RECORD. recname, a record name in quotation marks,  or a table name.

correlation_id

Identify the correlation ID to be used for the select_recname records and fields.

override_field

Specify the name of a field on insert_recname that you want to supply a value for (instead of using the value supplied from the select_recname.)

Value

Specify the value that should be used for the override_field instead of the value from select_recname.

Example

Here is a basic example:

下面是一个基本的例子:

%InsertSelect(AE_SECTION_TBL, AE_STEP_TBL S, AE_SECTION_TYPE = ' ')

   FROM PS_AE_STEP_TBL S, PS_AS_STMT_TBL T WHERE. . .

The example code resolves into the following:

示例代码解析为以下内容:

INSERT INTO PS_AE_SECTION_TBL (AE_APPLID, AE_SECTION,. . ., AE_SECTION_TYPE)

SELECT S.AE_APPL_ID, S.AE_SECTION, . . . ' '

FROM PS_AE_STEP_TBL S, PS_AS_STMT_TBL T    WHERE. . .

In the following example, you have a temporary table, PS_MY_TEMP, which is based on a join between two other tables, PS_MY_TABLE1 and PS_MY_TABLE2:

在以下示例中,您有一个临时表PS_MY_TEMP,它基于另外两个表PS_MY_TABLE1和PS_MY/TABLE2之间的联接:

%InsertSelect(MY_TEMP, MY_TABLE1, MY_TABLE2 T2)

   FROM PS_MY_TABLE1 T1, PS_MY_TABLE2 T2 WHERE %Join(COMMON_KEYS, MY_TABLE1 T1, MY_TABLE2 T2) . . .

This code resolves into:

这段代码解析为:

INSERT INTO PS_MY_TEMP (FIELD1, FIELD2 . . .)    SELECT T2.FIELD1, T2.FIELD2, . . .

FROM PS_MY_TABLE1 T1, PS_MYTABLE2 T2

WHERE T1.FIELD1 = T2.FIELD1 AND T1.FIELD2 = T2.FIELD2 . . .

The following example creates a distinct Select statement.

下面的示例创建一个独特的Select语句。

%InsertSelect(DISTINCT, MY_TABLE, TABLE1, TABLE2 T2)

   FROM PS_TABLE1 T1, PS_TABLE2 T2 WHERE %Join(COMMON_KEYS, TABLE1 T1, TABLE2 T2) . . .

This code resolves into:

这段代码解析为:

INSERT INTO PS_MYTABLE (FIELD1, FIELD2 . . .)    SELECT DISTINCT T2.FIELD1, T2.FIELD2, . . .

FROM PS_TABLE1 T1, PS_TABLE2 T2

WHERE T1.FIELD1 = T2.FIELD1 AND T1.FIELD2 = T2.FIELD2 . . .

Related Links %InsertSelectWithLongs

相关链接%Insert Select with Long

%InsertSelectWithLongs

Syntax

%InsertSelectWithLongs([DISTINCT, ]insert_recname, select_recname [ correlation_id]⇒

[, select_recname_n [ correlation_id_n]] [, override_field = value]. . .)

Description

The %InsertSelectWithLongs meta-SQL construct generates an Insert statement with a Select statement. It does not generate a From statement. You must specify the select records before you specify override fields.

Insert Select With Long元SQL构造使用Select语句生成一个Insert语句。它不生成From语句。在指定覆盖字段之前,必须指定选择记录。

Use %InsertSelectWithLongs instead of %InsertSelect when the fields in insert_recname  include long values (LongChar and Image fields).

当insert_recname中的字段包含长值(LongChar和Image字段)时,使用%InsertSelectWithLongs代替%InsertSelect。

Note: %InsertSelectWithLongs has a limit of 99 override fields.

附注:%Insert Select With Long限制为99个覆盖字段。

The Insert column list is composed of all the fields in the specified insert_recname.

“插入”列列表由指定的insert_recname中的所有字段组成。

The corresponding value in the Select list is generated based on the following precedence:

选择列表中的相应值将根据以下优先级生成:

  1. If the Insert fieldname appears as an override_field, the corresponding value is used in the Select list.

如果Insert字段名显示为override_field,则在Select列表中使用相应的值。

  1. If the Insert field name matches a field name in one of the select_recname variables specified, the corresponding Select field is used in the Select list.

如果Insert字段名与指定的select_recname变量中的某个字段名匹配,则在Select列表中使用相应的Select字段。

  1. The search order of the select_recname records is the order that they are specified in the %InsertSelectWithLongs function.

select_recname记录的搜索顺序是在%InsertSelect函数中指定的顺序。

  1. If the Insert field name has a constant default value defined in Application Designer, that value is used in the Select list.

如果“插入”字段名具有在应用程序设计器中定义的常量默认值,则在“选择”列表中使用该值。

  1. A default value appropriate for the data type of the Insert field is used (blank for characters, zero for numbers, NULL for Date, Time, and DateTime values, and so on.) Use the optional override_field variable to specify values for a particular field.

使用与Insert字段的数据类型相适应的默认值(空格表示字符,0表示数字,NULL表示Date、Time和DateTime值,等等)。

Note: You cannot use bind variables with the override_field.

注意:不能将绑定变量与override_field一起使用。

For each field you specify, the matching logic described in the preceding list is not performed. Instead, the value that you specify after the equal sign is used for that field in the actual Select list. Use this technique to let PeopleTools or Application Engine handle most of the fields in the record, while specifying some of them explicitly. Also, you can use override_field to specify aggregate functions like Sum, Max, and so on.

对于您指定的每个字段,不执行前面列表中描述的匹配逻辑。相反,在等号后面指定的值将用于实际的“选择”列表中的该字段。使用此技术可以让PeopleTools或应用程序引擎处理记录中的大多数字段,同时显式指定其中的一些字段。此外,还可以使用override_field指定聚合函数,如Sum、Max等。

Note: This meta-SQL is not implemented for COBOL.

注意:这个元SQL不是为COBOL实现的。

Parameters

Parameter

Description

DISTINCT

Specify if the Select statement being generated should contain a Distinct clause.

insert_recname

Specify the name of record being inserted into. You must specify a record name, not RECORD. recname, a record name in quotation marks, a bind variable, or a table name.

Note: If the record for insert_recname is a temporary table,  %InsertSelectWithLongs automatically substitutes the corresponding table instance (PS_TARGETnn instead of PS_ TARGET).

select_recname

Specify the name of record being selected from. You can specify more than one record. You must specify a record name,  not a RECORD. recname, a record name in quotation marks,  or a table name.

correlation_id

Identify the correlation ID to be used for the select_recname records and fields.

Parameter

Description

override_field

Specify the name of a field on insert_recname that you want to supply a value for (instead of using the value supplied from the select_recname.)

Value

Specify the value that should be used for the override_field instead of the value from select_recname.

Example

Here is a basic example:

下面是一个基本的例子:

%InsertSelectWithLongs(AE_SECTION_TBL, AE_STEP_TBL S, AE_SECTION_TYPE = ' ')

   FROM PS_AE_STEP_TBL S, PS_AS_STMT_TBL T WHERE. . .

The example code resolves into the following:

示例代码解析为以下内容:

INSERT INTO PS_AE_SECTION_TBL (AE_APPLID, AE_SECTION,. . ., AE_SECTION_TYPE)

SELECT S.AE_APPL_ID, S.AE_SECTION, . . . ' '

FROM PS_AE_STEP_TBL S, PS_AS_STMT_TBL T    WHERE. . .

In the following example, you have a temporary table, PS_MY_TEMP, which is based on a join between two other tables, PS_MY_TABLE1 and PS_MY_TABLE2:

在以下示例中,您有一个临时表PS_MY_TEMP,它基于另外两个表PS_MY_TABLE1和PS_MY/TABLE2之间的联接:

%InsertSelectWithLongs(MY_TEMP, MY_TABLE1, MY_TABLE2 T2)

   FROM PS_MY_TABLE1 T1, PS_MY_TABLE2 T2 WHERE %Join(COMMON_KEYS, MY_TABLE1 T1, MY_TABLE2 T2) . . .

This code resolves into:

这段代码解析为:

INSERT INTO PS_MY_TEMP (FIELD1, FIELD2 . . .)    SELECT T2.FIELD1, T2.FIELD2, . . .

FROM PS_MY_TABLE1 T1, PS_MYTABLE2 T2

WHERE T1.FIELD1 = T2.FIELD1 AND T1.FIELD2 = T2.FIELD2 . . .

The following example creates a distinct Select statement.

下面的示例创建一个独特的Select语句。

%InsertSelectWithLongs(DISTINCT, MY_TABLE, TABLE1, TABLE2 T2)

   FROM PS_TABLE1 T1, PS_TABLE2 T2 WHERE %Join(COMMON_KEYS, TABLE1 T1, TABLE2 T2) . . .

This code resolves into:

这段代码解析为:

INSERT INTO PS_MYTABLE (FIELD1, FIELD2 . . .)    SELECT DISTINCT T2.FIELD1, T2.FIELD2, . . .

FROM PS_TABLE1 T1, PS_TABLE2 T2

WHERE T1.FIELD1 = T2.FIELD1 AND T1.FIELD2 = T2.FIELD2 . . .

Related Links

%InsertSelect

相关链接% InsertSelect

%InsertValues

Syntax

%InsertValues(recname)

Description

The %InsertValues meta-SQL construct produces a comma-separated list of the record's non-null field values. Input processing is applied to the fields in the following ways:

InsertValues元SQL构造生成记录的非空字段值的逗号分隔列表。输入处理以下列方式应用于字段:

  • If the field is a Date, a Time, or a DateTime data type, its value is automatically wrapped in %Datein, %TimeIn, or %DateTimeIn, respectively.
  • 如果字段是Date、Time或DateTime数据类型,则其值将分别自动包装在%Datein、%TimeIn或%DateTime In中。
  • If the field is a string, its value is automatically wrapped in quotation marks.
  • 如果字段是字符串,它的值会自动用引号括起来。
  • If the field has a null value, it is not included in the list.
  • 如果字段有空值,则不包括在列表中。

Note: This meta-SQL construct can only be used in PeopleCode programs, not in Application Engine SQL actions. Also, this meta-SQL construct is not implemented for COBOL.

附注:这个元SQL构造只能在PeopleCode程序中使用,不能在Application Engine SQL操作中使用。而且,这个元SQL构造也不是为COBOL实现的。

Parameters

Parameter

Description

recname

Specify the name of the record to be used for inserting. This can be a bind variable, a record object, or a record name in the form recname. You can't specify a RECORD. recname, a record name in quotation marks, or a table name.

Example

Here's an example:

这里有一个例子:

SQLExec("Insert into TABLE (%List(NonNull_Fields, :1)) values (%InsertValues(:1))",⇒  &Rec);

This example code is expanded into:

"Insert into TABLE (FNUM, FCHAR, FDATE) values (27, 'Y', %datein('1989-11-27'))"

%IsRunningOnline

Description

Use the %IsRunningOnline meta-variable to determine whether the current Application Engine program is running in online mode or batch mode.

使用%IsRunningOnline元变量确定当前应用程序引擎程序是以联机模式还是批处理模式运行。

Returns

If %IsRunningOnline = 'N', then the current Application Engine program is running in batch mode.

如果% IsRunningOnline =‘ N ’,那么当前的应用程序引擎程序正在批量模式下运行。

If %IsRunningOnline = 'Y', then the current Application Engine program is running in online mode.

如果% IsRunningOnline =“ Y ”,那么当前应用程序引擎程序正在联机模式下运行。

Examples

%Select(FS_BP_WRK_AET.SELECT_FLAG)

 SELECT 'X'

  FROM PS_INSTALLATION

 WHERE %IsRunningOnline = 'N'

%Select(FS_BP_WRK_SET.SELECT_FLAG

 SELECT 'X'

  FROM PS_INSTALLATION

 WHERE %IsRunningOnline = 'Y'

%Join

Syntax

%Join({COMMON_KEYS | COMMON_FIELDS}, join_recname [ correlation_id1], to_recname

[ correlation_id2] [, override_field_list])

where override_field_list is an arbitrary-length list of fields to be substituted in the resulting text string, in the form: field1 [, field2]. . .

其中override_field_list是在结果文本字符串中被替换的任意长度的字段列表,形式为: field1 [, field2]. . .

Description

Use the %Join meta-SQL construct to dynamically build a Where clause joining one table to another. At runtime, the entire construct is replaced with a character string.

使用%Join meta-SQL构造来动态构建一个将一个表连接到另一个表的Where子句。在运行时,整个构造被替换为一个字符串。

Note: This meta-SQL construct is not implemented for COBOL. If date key fields are not marked as required in the record definition for either of the referenced tables in the %Join clause, a Null clause check is added to the date field comparison. This additional clause can have a significant impact on the execution time for the generated SQL statement.

注意:这个元SQL构造不是为COBOL实现的。如果在%Join子句中的两个引用表的记录定义中未按要求标记日期关键字字段,则会在日期字段比较中添加Null子句检查。这个附加子句会对生成的SQL语句的执行时间产生重大影响。

Parameters

Parameter

Description

{COMMON_KEYS | COMMON_FIELDS}

Use COMMON_KEYS to specify that all common primary key fields are used in constructing a Where clause; use COMMON_FIELDS to specify all common fields, not

just key fields. You can select either COMMON_KEYS or

COMMON_FIELDS.

join_recname

Specify the name of the record to be joined. This can be a bind variable, a record object, or a record name in the form recname. You can't specify a RECORD. recname, a record name in quotation marks, or a table name.

correlation_id1

Identify the correlation ID used to relate the record specified by join_recname and its fields.

to_recname

Specify the name of the record to be joined to. This can be a bind variable, a record object, or a record name in the form recname. You can't specify a RECORD. recname, a record name in quotation marks, or a table name.

correlation_id2

Identify the correlation ID used to relate the record specified by to_recname and its fields.

override_field_list

Specify a list of fields that you do not want used in the join.  For example, if fields A, B, and C were common to two records, and you didn't want to join on C, list C as an override _field.

Example

Here is an example:

%Join(COMMON_KEYS, PSAESECTDEFN ABC,  PSAESTEPDEFN XYZ)

The example code results in the following being generated:

ABC.AE_APPLID = XYZ.AE_APPLID

AND ABC.AE_SECTION = XYZ.AE_SECTION

AND ABC.DBTYPE = XYZ.DBTYPE

AND ABC.EFFDT = XYZ.EFFDT

Here's another example:

%Join(COMMON_FIELDS, PSAEAPPLDEFN ABC,  PSAESECTDEFN XYZ)

The second example results in the following being generated:

ABC.AE_APPLID = XYZ.AE_APPLID

AND ABC.DESCR = XYZ.DESCR

However, you do not want to perform the join using the DESCR field because it's a long field. Instead use override_field, as shown in the following code:

%Join(COMMON_FIELDS, PSAEAPPLDEFN ABC,  PSAESECTDEFN XYZ, DESCR)

This example results in the following being generated:

ABC.AE_APPLID = XYZ.AE_APPLID

You can also specify a value for a field. Suppose you want to join two tables, but not on the field C3. In addition, you would like to specify a value for C3. Your code could look like the following:

%Join(COMMON_FIELDS, MY_TABLE1 A, MY_TABLE2 B, C3) AND C3 = 'XX'

%JobInstance

Description

Use the %JobInstance meta-variable to specify the numeric (unquoted) PeopleSoft Process Scheduler job instance.

使用%JobInstance元变量来指定PeopleSoft Process Scheduler作业实例。

%KeyEqual

Syntax

%KeyEqual(recname [ correlation_id])

Description

The %KeyEqual meta-SQL construct expands into a conditional phrase suitable for use in a Where clause.

KeyEqual元SQL构造扩展为适合在Where子句中使用的条件短语。

The conditional phrase consists of a conjunction (AND) of [correlation_id.]keyfieldname = 'keyfieldvalue' phrases for each key field of the given record.

条件短语由【 correlation _ id .】 keyfieldname =‘ keyfieldvalue ’短语的连接词( AND )组成,用于给定记录的每个键字段。

No auto-update processing is done, but other input processing is applied to the values, according to the following:

没有进行自动更新处理,但根据以下内容,对值应用了其他输入处理:

  • If the field is a Date, a Time, or a DateTime data type, its value is automatically wrapped in %Datein, %TimeIn, or %DateTimeIn, respectively.
  • 如果字段是Date、Time或DateTime数据类型,则其值将分别自动包装在%Datein、%TimeIn或%DateTime In中。
  • If a value is a string, its value is automatically wrapped in quotation marks.
  • 如果一个值是字符串,它的值会自动用引号括起来。
  • If a value is NULL, the "=value" part is replaced with "IS NULL".
  • 如果值为 NULL ,则“= value ”部分被替换为“ IS Null ”。

Note: This meta-SQL can only be used in PeopleCode programs, not in Application Engine SQL actions. Also, this meta-SQL is not implemented for COBOL.

注意:这个元SQL只能在PeopleCode程序中使用,不能在Application Engine SQL操作中使用。而且,这个元SQL不是为COBOL实现的。

Example

Suppose that the record &REC has three keys: FNUM, FDATE, and FSMART. Here is a code example:

假设Record &REC有三个键:FNUM、FDATE和FSMART。下面是一个代码示例:

Local record &REC;

&REC = CreateRecord(RECORD.MYRECORD);

&REC.FNUM.Value = 27;

&REC.FDATE.Value = %Date;

SQLExec("Delete from MYRECORD A where %KeyEqual(:1 A)", &REC);

This example expands to:

"Delete from TABLE A    where A.FNUM = 27    AND A.FDATE = %Date('1989-11-27')

   AND A.FSMART IS NULL"

%KeyEqualNoEffDt

Syntax

%KeyEqualNoEffDt(recname [ correlation_id])

Description

The %KeyEqualNoEffDt meta-SQL construct expands into a conditional phrase suitable for use in a Where clause.

KeyEqualNoEffDt meta-SQL构造扩展为适合在Where子句中使用的条件短语。

The conditional phrase consists of a conjunction (AND) of [correlation_id.]keyfieldname = 'keyfieldvalue' phrases for all key fields of the given record, except that it omits any key field named EFFDT.

条件短语由【 correlation _ id .】 keyfieldname =‘ keyfieldvalue ’短语的连接( AND )组成,用于给定记录的所有关键字段,但它忽略了任何名为 EFFDT 的关键字段。

No auto-update processing is done, but other input processing is applied to the values as follows:

不会执行自动更新处理,但会对值应用其他输入处理,如下所示:

  • If the field is a Date, a Time, or a DateTime data type, its value is automatically wrapped in %Datein, %TimeIn, or %DateTimeIn, respectively.
  • 如果字段是Date、Time或DateTime数据类型,则其值将分别自动包装在%Datein、%TimeIn或%DateTime In中。
  • If a value is a string, its value is automatically wrapped in quotation marks.
  • 如果一个值是字符串,它的值会自动用引号括起来。
  • If a value is NULL, the "=value" part is replaced with "IS NULL."
  • 如果值为 NULL ,则“= value ”部分被替换为“ IS Null ”。

Note: This meta-SQL can only be used in PeopleCode programs, not in Application Engine SQL actions. Also, this meta-SQL is not implemented for COBOL.

注意:这个元SQL只能在PeopleCode程序中使用,不能在Application Engine SQL操作中使用。而且,这个元SQL不是为COBOL实现的。

Parameters

Parameter

Description

recname

Specify the name of the record to be used for inserting. This can be a bind variable, a record object, or a record name in the form recname. You can't specify RECORD. recname, a record name in quotation marks, or a table name.

correlation_id

Identify the single-letter correlation ID to relate the record specified by recname and its fields.

Example

The EMPL_CHECKLIST record has three keys: EMPLID, CHECK_SEQ, and EFFDT. Here is a code example:

Empl_核对表记录有三个键:EMPLID、CHECK_SEQ和EFFDT。下面是一个代码示例:

&REC = CreateRecord(EMPL_CHECKLIST);

SQLExec("Delete from TABLE A where %KeyEqualNoEffdt(:1 A)", &REC)

The example expands to:

"Delete from TABLE A    where A.EMPLID = 8001    AND A.CHECK_SEQ = 00001"m

你可能感兴趣的:(peoplesoft,数据库,sql,oracle,peoplecode,peoplesoft)