Skip to content

Commit 182c102

Browse files
committed
Reformatted da/chronbyidv2 and fixed the smallint issue.
1 parent 90eb78e commit 182c102

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

function/da/chronologybyidv2.sql

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,43 @@
11
CREATE OR REPLACE FUNCTION da.chronologybyidv2(chronid integer)
2-
RETURNS TABLE(chronologyid integer, agetype character varying, isdefault smallint, chronologyname character varying, dateprepared date, agemodel character varying, ageboundyounger integer, ageboundolder integer, datasetidnotes character varying, chroncontrolid integer, controldepth double precision, controlthickness double precision, controlage double precision, controlageyounger double precision, controlageolder double precision, chroncontroltype character varying)
2+
RETURNS TABLE(chronologyid integer,
3+
agetype character varying,
4+
isdefault boolean,
5+
chronologyname character varying,
6+
dateprepared date,
7+
agemodel character varying,
8+
ageboundyounger integer,
9+
ageboundolder integer,
10+
datasetidnotes character varying,
11+
chroncontrolid integer,
12+
controldepth double precision,
13+
controlthickness double precision,
14+
controlage double precision,
15+
controlageyounger double precision,
16+
controlageolder double precision,
17+
chroncontroltype character varying)
318
LANGUAGE sql
419
AS $function$
520

6-
SELECT ndb.chronologies.chronologyid, ndb.agetypes.agetype, ndb.chronologies.isdefault, ndb.chronologies.chronologyname, ndb.chronologies.dateprepared,
7-
ndb.chronologies.agemodel, ndb.chronologies.ageboundyounger, ndb.chronologies.ageboundolder,ndb.chronologies.notes, ndb.chroncontrols.chroncontrolid,
8-
ndb.chroncontrols.depth AS controldepth, ndb.chroncontrols.thickness AS controlthickness, ndb.chroncontrols.age AS controlage, ndb.chroncontrols.agelimityounger AS controlageyounger,
9-
ndb.chroncontrols.agelimitolder AS controlageolder, ndb.chroncontroltypes.chroncontroltype
10-
FROM ndb.chronologies INNER JOIN ndb.agetypes ON ndb.chronologies.agetypeid = ndb.agetypes.agetypeid LEFT JOIN
11-
ndb.chroncontrols ON ndb.chronologies.chronologyid = ndb.chroncontrols.chronologyid LEFT JOIN
12-
ndb.chroncontroltypes ON ndb.chroncontrols.chroncontroltypeid = ndb.chroncontroltypes.chroncontroltypeid
13-
WHERE ndb.chronologies.chronologyid = chronid;
21+
SELECT chr.chronologyid,
22+
aty.agetype,
23+
chr.isdefault,
24+
chr.chronologyname,
25+
chr.dateprepared,
26+
chr.agemodel,
27+
chr.ageboundyounger,
28+
chr.ageboundolder,
29+
chr.notes,
30+
chcr.chroncontrolid,
31+
chcr.depth AS controldepth,
32+
chcr.thickness AS controlthickness,
33+
chcr.age AS controlage,
34+
chcr.agelimityounger AS controlageyounger,
35+
chcr.agelimitolder AS controlageolder,
36+
cct.chroncontroltype
37+
FROM ndb.chronologies AS chr
38+
INNER JOIN ndb.agetypes AS aty ON chr.agetypeid = aty.agetypeid
39+
LEFT JOIN ndb.chroncontrols AS chcr ON chr.chronologyid = chcr.chronologyid
40+
LEFT JOIN ndb.chroncontroltypes AS cct ON chcr.chroncontroltypeid = cct.chroncontroltypeid
41+
WHERE chr.chronologyid = chronid;
1442

1543
$function$

0 commit comments

Comments
 (0)