OPTION Clause
The OPTION
keyword denotes options the user can pass with the command. These options are specific to the Data Virtuality Server and not covered by any SQL specification.
Usage
OPTION option (option)*
Supported Options
To view the full table, click the expand button in its top right corner
Option | Usage | Description |
---|---|---|
MAKEDEP | MAKEDEP table [(,table)*] | Specifies source tables that should be made dependent in the join |
MAKENOTDEP | MAKENOTDEP table [(,table)*] | Prevents a dependent join from being used |
NOCACHE | NOCACHE [table (,table)*] | Prevents cache from being used for all tables or the given tables. All tables specified in the OPTION clause should be fully qualified |
$NOOPT
| $NOOPT [FALSE | TRUE] | If TRUE (or if the modifier is omitted), no recommended optimizations are created for queries. Already created optimizations will still be used. Default: FALSE |
$NOFAIL | $NOFAIL [FALSE | TRUE] | Prevents a procedure from throwing an error in case of failure. Error will be silently ignored. Processed only when applied to:
The Data Virtuality Exporter adds "
|
$PREFER_DWH
|
|
|
$ALLOW_CARTESIAN
| $ALLOW_CARTESIAN (NEVER | INTERNAL | IMPLICIT | EXPLICIT | ALWAYS) |
|
$ALLOW_XML_TEXT_NODE_WHITESPACE | $ALLOW_XML_TEXT_NODE_WHITESPACE [FALSE | TRUE]
| XMLQuery, XMLTable streaming mode specific option. Allows handling elements that contain only whitespaces. Elements that contain only whitespaces are handled as empty if this option is not enabled |
Examples
$NOFAIL
CALL "SYSADMIN.setRemark"("name" => 'views.doesnotexist', "remark" => 'this is a new comment') OPTION $NOFAIL;;
$PREFER_DWH
In this example, the join is performed within the same schema (data source):
SELECT <sth.> FROM schemaA.tableA <some_join> schemaA.tableB ON <some_condition> ...
$ALLOW_CARTESIAN
1. Examples with a query with an explicit cross join:
SELECT * FROM SchemaA.TableA, SchemaB.TableB
SELECT * FROM SchemaA.TableA CROSS JOIN SchemaB.TableB
2. Example of a query with an internal cross join:
SELECT * FROM (EXEC file.getFiles('1.csv')) f, TEXTTABLE(TO_CHARS(f.file,'ISO-8859-15') COLUMNS ...)
3. Example of a query which results in an implicit cross join:
SELECT CAST((SUM((CASE WHEN (("order_position"."state" = 512) OR ("order_position"."state" = 1024)) THEN 1 ELSE 0 END)) - SUM((CASE WHEN ("order_position"."state" = 512) THEN 1 ELSE 0 END))) AS FLOAT) AS "usr_Retourenquote_St_ck_Kopie_qk"
FROM "test_dvcore301_1"."public.order_position" "order_position"
INNER JOIN "test_dvcore301_2"."public.customer_order" "customer_order" ON ("order_position"."order_id" = "customer_order"."id")
INNER JOIN "test_dvcore301_1"."public.address" "address" ON ("customer_order"."shipping_address_id" = "address"."id")
INNER JOIN "test_dvcore301_2"."public.supplier_article" "supplier_article" ON ("order_position"."supplier_article_id" = "supplier_article"."id")
INNER JOIN "test_dvcore301_2"."public.article" "article" ON ("order_position"."article_id" = "article"."id")
INNER JOIN "test_dvcore301_2"."public.article_details" "article_details" ON ("order_position"."supplier_article_id" = "article_details"."id")
INNER JOIN "test_dvcore301_2"."public.principal" "principal" ON ("customer_order"."customer_id" = "principal"."id")
INNER JOIN "test_dvcore301_2"."public.principal" "stylist" ON ("customer_order"."stylelist_id" = "stylist"."id")
WHERE ((("article_details"."category" IS NULL) OR (("article_details"."category" >= '') AND
("article_details"."category" <= 'Some Category'))) AND (("article_details"."season" IS NULL)
OR (("article_details"."season" >= 'Season') AND ("article_details"."season" <= 'Season2')))
AND (("customer_order"."date_shipped" >= {ts '2012-02-02 18:00:00'}) AND ("customer_order"."date_shipped" <= {ts '2013-02-14 17:27:08.222000'}))) HAVING (COUNT(1) > 0)
OPTION $NOOPT
$ALLOW_XML_TEXT_NODE_WHITESPACE
Examples of am XMLTABLE
query with the option enabled:
SELECT
xt.NAME,
xt.SURNAME,
LENGTH(xt.SURNAME) AS SURNAME_LENGTH
FROM XMLTABLE(
'/root/band_members/band_member'
PASSING XMLPARSE(
DOCUMENT
'<root>
<band_members>
<band_member>
<name>George</name>
<surname> </surname>
</band_member>
<band_member>
<name>Ringo</name>
<surname></surname>
</band_member>
</band_members>
</root>'
)
COLUMNS
NAME STRING PATH 'name',
SURNAME STRING PATH 'surname'
) xt
OPTION $ALLOW_XML_TEXT_NODE_WHITESPACE;;
-- returns:
/*
NAME SURNAME SURNAME_LENGTH
George 1
Ringo 0
*/