WITH
+connections AS (
SELECT spfli~carrid, carrname, connid, cityfrom, cityto
FROM spfli
INNER JOIN scarr
ON scarr~carrid = spfli~carrid
WHERE spfli~carrid = 'LH' ),
+sum_seats AS (
SELECT carrid, connid, SUM( seatsocc ) AS sum_seats
FROM sflight
WHERE sflight~carrid = 'LH'
GROUP BY carrid, connid ),
+result( name, connection, departure, arrival, occupied ) AS (
SELECT carrname, c~connid, cityfrom, cityto, sum_seats
FROM +connections AS c
INNER JOIN +sum_seats AS s
ON c~carrid = s~carrid AND
c~connid = s~connid )
SELECT *
FROM +result
ORDER BY name, connection
WITH +a AS (
SELECT
t~formname,
t~caption,
d~ddtext
FROM
stxfadmt AS t
INNER JOIN stxfadm AS f ON (
t~formname = f~formname
AND t~langu = 'E'
)
INNER JOIN DD07T AS d ON (
f~formtype = d~domvalue_l
AND d~domname = 'TDSFTYPE'
AND d~ddlanguage = 'E'
)
),
+result AS (
SELECT
COUNT(*) as kount FROM +a )
SELECT *
FROM +result
WITH +a AS (
SELECT
COUNT(*) AS kount
FROM
stxfadmt )
SELECT kount
FROM +a
SELECT connid as FlightConnectionNo,
airpfrom as AirportFrom,
\_sflight-fldate as FlightDate,
\_sflight-price as AirFare,
\_sflight-currency as LocalCurrency
FROM DEMO_CDS_ASSOC_SPFLI
WHERE airpfrom = 'SIN
BEGIN "OPEN"
NAME S_CARRNAME
CONNECTION S_CONN_ID
CITYFROM S_FROM_CIT
CITYTO S_TO_CITY
SEATSOCC S_SEATSOCC "SUM SEATS
END
WITH
+connections AS (
SELECT spfli~carrid, carrname, connid, cityfrom, cityto
FROM spfli
INNER JOIN scarr
ON scarr~carrid = spfli~carrid
WHERE spfli~carrid = 'LH' ),
+sum_seats AS (
SELECT carrid, connid, SUM( seatsocc ) AS sum_seats
FROM sflight
WHERE sflight~carrid = 'LH'
GROUP BY carrid, connid ),
+result( name, connection, departure, arrival, occupied ) AS (
SELECT carrname, c~connid, cityfrom, cityto, sum_seats
FROM +connections AS c
INNER JOIN +sum_seats AS s
ON c~carrid = s~carrid AND
c~connid = s~connid )
SELECT *
FROM +result
ORDER BY name, connection
Native Example
begin "Tables Rows Usage Oracle Native
tblnam char30 "TableName
numrows int4 "NumRows
avgrowlen int4 "AvgRowLen
lastdt dats "LastDate
contflag char1 "Type
end
select a.table_name,
a.num_rows,
a.avg_row_len,
TO_CHAR(a.last_analyzed,'YYYYMMDD') As last_analyzed,
NVL(s.contflag,'A') as contflag
from USER_tables a, DD02L s
where a.table_name = s.tabname (+)
and s.contflag not in ('S','W')
and a.num_rows is not NULL
and a.num_rows > 0
order by num_rows desc, table_name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
4 | |
4 | |
4 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 |