Examples Of Select - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

SELECT common.isma_no FROM sdcommon common
WHERE common.sec_status='L'
UNION
SELECT main.isma_no FROM sdmain main
WHERE main.iss_eligible='Y'
FOR READ UNCOMMITTED ACCESS
ORDER BY 1 ASCENDING;
This statement will receive a warning:
*** WARNING[3192] Union operands sdcommon common and sdmain main have different transaction access/lock modes.
To apply access you specified for the second operand to both SELECT items in this type of query,
use one of these strategies:
Specify the desired access mode for each SELECT:
SELECT common.isma_no FROM sdcommon common
WHERE common.sec_status='L'
FOR READ UNCOMMITTED ACCESS
UNION
SELECT main.isma_no FROM sdmain main
WHERE main.iss_eligible='Y'
FOR READ UNCOMMITTED ACCESS
ORDER BY 1 ASCENDING;
Use a table subquery to enclose the union, and apply the access mode to the main query.
This statement receives a warning because Neoview SQL treats the access mode on the
second SELECT as applicable only to that second SELECT:
SELECT a
from t046a where b=1
UNION
SELECT b from t046b where a=2
for browse access;
This statement uses a table subquery to apply the access mode to both queries:
SELECT c from
(SELECT a from t046a where b=1
UNION
SELECT b from t046b where a=2) as t(c)
for browse access;
Specify the access mode after the ORDER BY clause:
SELECT common.isma_no
from sdcommon common
where common.sec_status='L'
UNION
SELECT main.isma_no
from sdmain main
where main.iss_eligible='Y'
ORDER BY 1 ascending for browse access;

Examples of SELECT

Retrieve information from the EMPLOYEE table for employees with a job code greater than
500 and who are in departments with numbers less than or equal to 3000, displaying the
results in ascending order by job code:
SELECT jobcode, deptnum, first_name, last_name, salary
FROM persnl.employee
WHERE jobcode > 500 AND deptnum <= 3000
ORDER BY jobcode
READ UNCOMMITTED ACCESS;
JOBCODE
-------
600
156
SQL Statements
DEPTNUM
FIRST_NAME
-------
---------------
1500
JONATHAN
LAST_NAME
SALARY
-----------
----------
MITCHELL
32000.00

Advertisement

Table of Contents
loading

Table of Contents