Home » SQL & PL/SQL » SQL & PL/SQL » SQL Query Help - Creating Report
SQL Query Help - Creating Report [message #327482] Mon, 16 June 2008 09:26 Go to next message
schilwan
Messages: 2
Registered: June 2008
Junior Member
I am unsure why the code below in blue does not work properly. For some reason it will not pick up the first sql in the report
i.e:
SELECT CAST(CAST(MIN(CALENDAR_DATE) AS INTEGER FORMAT '99999999') AS CHAR(08)) (TITLE '')
FROM BRP_SANDBOX.CL_START_DATE


When I change it to the table SC_CL_DATES_TO_DELETE which is the one further down in the query it works, and outputs a date.
The report outputs as followed, the ? in the output refers to the first select:

UPDATE BRP_SANDBOX.SC_CL_DATES_TO_DELETE
SET CALENDAR_DATE =
?
WHERE CALENDAR_DATE =
01070601
;

My assumption is that you can only do a select on one table when creating a sql report. Is this correct? Am I doing something incorrectly.


.SET WIDTH 550
.SET TITLEDASHES OFF
.EXPORT REPORT FILE=/tmp/test.sql


SELECT ' UPDATE BRP_SANDBOX.SC_CL_DATES_TO_DELETE ' (TITLE '')
;SELECT 'SET CALENDAR_DATE = '(TITLE '')
;SELECT CAST(CAST(MIN(CALENDAR_DATE) AS INTEGER FORMAT '99999999') AS CHAR(08)) (TITLE '')
FROM BRP_SANDBOX.CL_START_DATE
;SELECT 'WHERE CALENDAR_DATE = ' (TITLE '')
; SELECT CAST(CAST(MIN(CALENDAR_DATE) AS INTEGER FORMAT '99999999') AS CHAR(08)) (TITLE '')
FROM BRP_SANDBOX.SC_CL_DATES_TO_DELETE
;SELECT ';' (TITLE '')
;SELECT '.IF ERRORCODE <> 0 THEN .GOTO SAM2END' (TITLE '')
;SELECT ' ' (TITLE '')
;SELECT '.LABEL SAM2END' (TITLE '')
;

.EXPORT RESET

.RUN FILE /tmp/test.sql
Re: SQL Query Help - Creating Report [message #327483 is a reply to message #327482] Mon, 16 June 2008 09:38 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
This is either MySQL or MS SQL.

It's definitely not Oracle SQL, which is that we at ORAFAQ know most about.
Re: SQL Query Help - Creating Report [message #327498 is a reply to message #327483] Mon, 16 June 2008 10:39 Go to previous messageGo to next message
schilwan
Messages: 2
Registered: June 2008
Junior Member
You are corect - its Teradata BTEQ. Sorry. Thought someone may know.
Re: SQL Query Help - Creating Report [message #327506 is a reply to message #327498] Mon, 16 June 2008 11:31 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Is there no Teradata forum? Maybe you find someone with more knowledge on this in this forum.

Regards
Michel
Previous Topic: synonym priority
Next Topic: Duplicate data in comma seperated output
Goto Forum:
  


Current Time: Sat Dec 03 10:12:32 CST 2016

Total time taken to generate the page: 0.21488 seconds