23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CAST<br />

82<br />

The following example shows the equivalent simple case expression:<br />

Notes • This function is not allowed in a GROUP BY clause.<br />

CAST<br />

SELECT name, city,<br />

CASE<br />

WHEN state = 'MA' THEN 'In Mass' ELSE 'Not in Mass'<br />

END<br />

FROM supplier;<br />

Name City searched_case(State,MA,In Mass,)<br />

---------------- ---------------- --------------------------------<br />

GolfWorld Suppl Boston In Mass<br />

Pool Swimming S Valkeala Not in Mass<br />

Nordic Ski Whol Hingham In Mass<br />

Champion Soccer Harrow Not in Mass<br />

ABC Sports Supp Boston In Mass<br />

Seasonal Sports Bedford In Mass<br />

Tennis Supplies Boston In Mass<br />

Boating Supplie Jacksonville Not in Mass<br />

Aerobic Supplie Newport Beach Not in Mass<br />

Sports Unlimite Irving Not in Mass<br />

SELECT name, city,<br />

CASE state<br />

WHEN 'MA' THEN 'In Mass' ELSE 'Not in Mass'<br />

END<br />

FROM supplier;<br />

Name City simple_case(State,MA,In Mass,)<br />

---------------- ---------------- ------------------------------<br />

GolfWorld Suppl Boston In Mass<br />

Pool Swimming S Valkeala Not in Mass<br />

Nordic Ski Whol Hingham In Mass<br />

Champion Soccer Harrow Not in Mass<br />

ABC Sports Supp Boston In Mass<br />

Seasonal Sports Bedford In Mass<br />

Tennis Supplies Boston In Mass<br />

Boating Supplie Jacksonville Not in Mass<br />

Aerobic Supplie Newport Beach Not in Mass<br />

Sports Unlimite Irving Not in Mass<br />

• Arguments to this function cannot be query expressions.<br />

Compatibility<br />

<strong>SQL</strong> compatible<br />

Converts an expression to another data type. The first argument is the expression to be<br />

converted. The second argument is the target data type.<br />

The length option for the data_type argument specifies the length for conversions to CHAR and<br />

VARCHAR data types. If omitted, the default is 1 byte.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!