Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 11 Aug 2010 @ 19:51:58 GMT


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


Subj:   Re: Create Macro statement
 
From:   Sapra, Kapil Dev

Hi,

Here is syntax..

Example : 1

     CREATE MACRO Empinfo
     AS (

        SELECT EmplId (TITLE 'Id')
        ,LastName  (TITLE 'Name')
        ,City  (TITLE 'City')
        FROM employee1
        ORDER BY 2;

        SELECT EmplId (TITLE 'Id')
        ,LastName  (TITLE 'Name')
        ,City  (TITLE 'City')
        FROM employee2
        ORDER BY 2;

        );

Example 2 :

     CREATE MACRO NewEmpl
        (number INTEGER
        ,name   VARCHAR(12)
        ,dept   INTEGER
        ,sex    CHAR
        ,dob    DATE FORMAT MMMbDDbYYYY
     ) AS (
        INSERT INTO employee
        (EmplId
        ,LastName
        ,DeptNo
        ,Sex
        ,DOB)
     VALUES
        (:number
        ,:name
        ,:dept
        ,:sex
        ,:dob);


     /* The following select verifies the insert or can say SQL-2 */ SELECT *
     FROM employee WHERE EmplId= :number; );

Best Regards,

Kapil Dev Sapra



     
  <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: 15 Jun 2023