Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 12 Feb 2008 @ 22:00:04 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: How to write procedure in teradata
From:   McCall, Glenn David

  exec DBC.sysexecsql ("some sql"); but i'm getting error.. as  

          > Code = 3822.
          > 3822:  Cannot resolve column 'SEL CURRENT_DATE'. Specify table or view.
          > Output directed to Answer set window.

I'm not sure why you would get that specific error, but you can't run that query like that. I strongly recommend you refer to the SP Manual (and others). Here is an extract from the SP manual:

Dynamic SQL Statements That Cannot Be Used In Stored Procedures The following statements cannot be used as dynamic SQL in stored procedures:

     * SELECT
     * SELECT ... INTO
     * SHOW

If you want to get the results of something use a cursor or a select into. If you need to get the results of some dynamic sql then insert into an intermediate table and retrieve the results via a cursor.

I might be going out on a limb here (because I don't know what you are trying to achieve), but you should also seriously consider whether you are going down the right path. I'm not that knowledgeable about Oracle, but I do know they tend to use SP's to process stuff. Teradata is most powerful when you process data in sets (i.e. via SQL - not cursors and SP's). You will not see the same level of performance with SP's processing data one row at a time compared to the performance of processing data in sets.

I hope this helps

Glenn Mc

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016