Similar to all other programming languages PeopleCode also has conventional data types like
- Number
- Date
- String
- Conventional data types
- Object data types
Conventional Data Types
Conventional data types supported by peopleCode are
-
Any
Remember how many times you used a variable without declarig it. Any is a data type which is assigned implicitly by PeopleCode when you use a variable without declaring it. So the data type of the variable is indetermined untill a value is assigned to it. After assigning a value it becomes of the type of value assigned to it.
The same applies to a variable which is declared with "Any" datatype.
-
Boolean
This variable is a single bit type that can be TRUE(1) or FALSE(0).
-
Date
This variable is a standard date that in PeopleCode is in the format YYYY-MM-DD and in the Oracle database is in the format DD-MM-YYY.
-
DateTime
This variable is exactly what it says—the date with the time—and is in the following format: YYYY-MM-DD-HH.MI.SS.SSSSSS.
-
Integer
This variable is a whole number with no decimal points.
Tips on when to use NUMBER, INTEGER, or FLOAT variables:
Use NUMBER when you are unsure, and it will be the primary default way to declare numbers. Use INTEGER when you are counting items; a good example is when you count rows in a rowset. Use FLOAT only when you are performance tuning and the application is already working—and you know what the result should be. -
Float
This variable represents a floating decimal point number. The FLOAT variable is a number using a machine floating binary point or double precision. And by default the NUMBER data type in PeopleCode is a floating decimal point representation.
-
Number
A NUMBER variable is a decimal value or integers; it can be any number that has decimal points. NUMBER and STRING are the most used variable types in PeopleCode. -
String
This variable can be a combination of letters, special characters, and numbers. It is
initialized by enclosing the declared string in quotes. You can use either single or double quotes. When you need to enclose a string within a string, one type of quote is enclosed by another type. The “best practice” is to enclose strings in double quotes and embedded strings in single quotes. - Time
Object data types
OBJECT variables have their own data types:
- PeopleCode Data Buffer Access Types Field, Record, Row, and Rowset.
- PeopleCode Display Data Types AnalyticGrid, Chart, Grid, GridColumn,
and Page.
- PeopleCode Internet Script Data Types Cookie, Request, and Response.
- PeopleCode Miscellaneous Data Types AESection, AnalyticInstance, Array, Crypt, Exception, File, Interlink, BIDocs, JavaObject (can only be declared as type Local), Message, MCFIMInfo, OptEngine, PostReport, ProcessRequest, RowsetCache, SoapDoc, SQL, SyncServer, TransformData (can only be declared as type Local), XmlDoc, and XmlNode (objects can only be declared as type Local).
- Global ApiObject Data Type Objects Session, PSMessages collection, PSMessages, all tree classes (trees, tree structures, nodes, levels, and etc.), and query classes.
- Local ApiObject Data Type Objects Meta SQL, Meta HTML, System
Variables, and RowSet.