|
|
Archives of the TeradataForum
Message Posted: Mon, 03 Mar 2008 @ 16:18:28 GMT
Subj: | | Re: Oracle function %ROWTYPE |
|
From: | | Curley, David |
1) I'm not sure there's an equivalent to ROWTYPE. Somebody else here could tell us if Teradata uses complex variables in stored procedures.
Instead, you'd have to declare a variable for each field in the row. (Not sure if Teradata has equivalent to object%TYPE, either, so you might
have to declare them with named types.)
(For those w/o Oracle experience, %ROWTYPE essentially lets you declare a variable or parameter with a type of row and containing the fields in
the base object. So if you declared a variable foo dbc.tables%ROWTYPE, you could then reference foo.databasename, foo.tablename, etc, all of
which would have the same types as dbc.tables.)
2) LAST_DAY(TRUNC(current_date,'YYYY')) is basically the same as you earlier question, except you want Jan 31 of this year, not Dec 31 of the
prior year. So any of the suggestions will work, just tack on '31-jan' or 0131 if you're doing the math version:
select cast('31-jan-' || trim(extract(year from current_date))
as date format 'dd-mmm-yyyy') ;
select cast(current_date/10000 * 10000 + 131 as date);
If you have lots of specialized date needs, you might want look into making a customized version of the calendar table, adding pre-
calculated dates where appropriate. For example, we've built one that includes next/prior business day, next/prior Friday/business Friday,
first/last of quarter, etc.
Dave
| |