5495 Stored Procedure 'DBC.SysExecSQL' does not exist

Problem:

CALL DBC.SysExecSQL('SELECT ADD_MONTHS(date,1)') ;

 

CALL DBC.SysExecSQL('SELECT ADD_MONTHS(date,1)') ;

 *** Failure 5495 Stored Procedure  'DBC.SysExecSQL' does not exist.

                Statement# 1, Info =0

 *** Total elapsed time was 1 second.

 

Cause:

This is a dynamic SQL , an INTERNAL Stored procedure known only to the PARSER and only CALL-able from inside another Stored procedure.

 

Solution:

Use inside another procedure.

Example:

Crate a file proc.txt

CREATE PROCEDURE USER.Test_date()

P0: BEGIN

CALL DBC.SysExecSQL('SELECT ADD_MONTHS(date,1)') ;

END P0

;

 

# bteq

 

 Teradata BTEQ 15.10.01.09 for LINUX. PID: 18064

 Copyright 1984-2016, Teradata Corporation. ALL RIGHTS RESERVED.

 Enter your logon or BTEQ command:

.logon User

 

.logon User

Password:

 *** Logon successfully completed.

 *** Teradata Database Release is 15.10.07.11

 *** Teradata Database Version is 15.10.07.11

 *** Transaction Semantics are BTET.

 *** Session Character Set Name is 'ASCII'.

 

 *** Total elapsed time was 1 second.

 

 BTEQ -- Enter your SQL request or BTEQ command:

.compile file=proc.txt;

 

.compile file=proc.txt;

 

 *** Procedure has been created.

 *** Total elapsed time was 1 second.

Comments