0 - 25 of 25 tags for macro

Does CREATE MACRO have an equivalent of CREATE PROCEDURE's SQL SECURITY clause? Or should the database of the user executing the macro always always have SELECT/UPDATE access, as needed, to the tables used in the MACRO?

Hi Guys,
I got a requirement to execute a macro within a macro.
 
Below is the example,
Replace Macro Macro1
(
Log INT,
user_id VARCHAR(10)
)
AS
(
INSERT INTO Table1
SELECT
xx,
xx,
version,
:user_id 
FROM volatile_value as t_bulk

Hi,
I'm new to TeraData and need to call a Macro from C# using the .Net Provider.
I wasn't able to find any sample code, and not sure what the correct way to do this.
I don't want toe send "exec macroName(param1)" from my code, I would like to have something similar to the way i call procedures.

I am attempting to write a macro to delete and drop specific tables from a database.  Any suggestions on fixing this or a better method?
SQL Statement:
CREATE MACRO tbl_nme AS
(SELECT TABLENAME
FROM    DBC.TablesV

Hi ,
Could someone help me with the following. Since I have the create table option within the macro, I need to change the tablename everytime I execute this macro with different parameters.
Is there a way around it? without having to change the table name everytime I execute this macro.
 

I wonder if possible to pass a long string of multiple conditions thru macro. Reason is because the combination of conditions varies upon the business rules. Another reason is unfortunately I have no permission to create procedure in TD.
-- original query condition

 In the script when i give the below where clause

I have several insert statements that needs to be executed in certain order. Can we accomplish this in a macro? 
If not any other suggestions?
As far as I understand a macro executes sql statments parallely and not sequentially.

Are TD macros supported in BO Universe? 
G.

I have a project specific requirement where I need to set a query band dynamically based on input parameters. I'm trying to achieve this via macros(we're on version 13.10). But the issue is that if I'm passing parameter to a macro that has only the "set query band" statement, I can only do it if the query is "for transaction" and not "for session".

Hello all,
I am trying to write a macro that takes 3 inputs from the user, Database1, Database2 and an integer value.
What I am trying to do, is to automate the "space moving function".
In the macro, I will write the 3 SQL statements

Greetings!

I'm trying to run a macro during a connection or with teradata using SAS and when I run the code I'm getting the error. What can be the reason? Error in teradata?

Hi,
I have the following tables EMPLOYEE& DEPT.
I am writing the following query :
 
validtime as of date '2001-01-01'
select *
from SANDBOX.TEMPORAL_EMPLOYEE AS EMP
join SANDBOX.TEMPORAL_DEPT as dept
on emp.dept_id=dept.dept_id;
 
 

Hi all;
 
I am doing some error checking / monitoring and was wondering is it possible to have a Marco set up to send out an e-mail notification if a certain set of circumstances have occured.  Does anyone have any insight on this?
I was thinking it would work somethink like this.
 creat macro ETL_JOB_TRACK

Hi,

 

I'm trying to call a Teradata macro via JDBC. I'm using the following code

Here is what I am trying to do... I am designing an extract process to export cusomters and orders.   The input will be list of customers and a date range.

The first thing it has to do is find all the orders in that data range for that group of customers.  Query on the order table.

Hi All,

In Teradata document, SQL Reference : Stored Procedures and Embedded SQL :Release V2R6.1

I have read something about calling MACRO inside a procedure and declaring the results in Cursor

(The content is given below) When I tried the same thing in procedure, I have got a error saying it is Invalid.

Hi,
The diff. between Macros and stored procedure in Teradata is that
stored procedure require physical storage.

Can anyone clarify what does physical storage mean
and how a stored procedure consume physical storage?

Is there a way to output the result of a MACRO to a log?

i.e. MACRO1 has a couple of selects, several updates, and additional selects -- I'd like to output the record counts (processed) from each statement,

i.e. "UPDATE completed. 100 rows processed." "SELECT completed. 5 rows returned;" etc.

... rather than just the total result of the MACRO, which is what I am current seeing, i.e. "Statement 1: EXECUTE completed. 211014 rows processed."

Is there an equivalent to user defined function (MS SQL) in teradata where I can write SQL that returns either a scaler or table which I can further use in a query.

For example:

SELECT sclfunctionName(param1, param2)

OR

SELECT * from tblfunctionName(param1, param2)

Both sclfunctionName and tblfunctionName contain some SQL.

I have tried it using a MACRO but don't know how I can use it in SELECT

CREATE MACRO tstMacro (param1 VARCHAR(10))
AS
(
SELECT fld1, fld2, fldm FROM tbl WHERE fldm = :param1;
-- my query is really long just a small one for example
);

like

I have a big list of stored procedures created in SQL server. I have to convert them to tereadata macros and need help in knowing logic for If and Else in a macro. Please help me with the macro structure. Thanks in advance.

Hi,
Is it possible to do conditional execution in macro based on the input parameter passed:

Below is a SAS script that passes variables thru the same code many times. I would like to do the same type of thing in Teradata with my initial code looking like this for an UPDATE.

1. First, this is an UPDATE statement
2. I need to observe the current month's and prior month's MISS_PMT_COUNT over years to determine the MOST RECENT TIME when a mortgage account went from delinquent to cured and vise versa.
3. If there is some way to determine &N observations on the MIN(STATEMENT_DATE) for the pass through values, that would be great.

Thank you in advance,

Below is a SAS script that passes variables thru the same code many times. I would like to do the same type of thing in Teradata with my initial code looking like this for an UPDATE.

1. First, this is an UPDATE statement
2. I need to observe the current month's and prior month's MISS_PMT_COUNT over years to determine the MOST RECENT TIME when a mortgage account went from delinquent to cured and vise versa.
3. If there is some way to determine &N observations on the MIN(STATEMENT_DATE) for the pass through values, that would be great.

Thank you in advance,

Macros dont use perm space
Stored procedure requires perm space
Why?