Skip to Content
-1

Database stored procedure print or message statement for tracing

Jun 09, 2017 at 02:56 PM

631

avatar image
Former Member

Using HANA 1.00 or 2.00.

If the feature exists, please let know which version or SP to use of HANA.

Consider this stored procedure (not SQLScript):

In a HANA stored procedure (not SQLScript) is there some tracing statement I can use to write to some log that I can look up later.

For example, consider this procedure:

CREATE PROCEDURE sp_test( p_new_TRANSID NVARCHAR( 32 ) )
AS
lv_uuid1 NVARCHAR( 40 );
BEGIN
lv_uuid1 = SYSUUID;
INSERT INTO "TTEST_SYN_VALD" ( "MANDT", "GUID", "TRANSID", "TABLE_NAME" )
VALUES( '230', lv_uuid1, p_new_TRANSID, 'T_WORKORD' );

// I want to add the UUID to some HANA trace file to view later
END

After generating the SYSUUID, I would like to print that value out into some HANA tracing file so that after the fact (14 days later) I can view this output.

The output would look something like this:

sp_test:UUID:<the generated value> TRANSID:<p_new_TRANSID>

Hopefully it would have some form at timestamp on it for later reference.

In other databases I can do this with a "MESSAGE statement" like this:

MESSAGE 'sp_test:UUID:' + string(lv_uuid1) + ' TRANSID:' + string(p_new_TRANSID) + ' when:' + string(CURRENT TIMESTAMP);

I am looking for some equivalent in HANA.

Thanks in advance for any responses.

David

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Lars Breddemann
Jun 13, 2017 at 06:15 AM
0

I suppose you know that about other databases, because at one point you checked the documentation.

Let's try the same for HANA!

Then you could find the TRACE command for SQL Script.

Alternatively you could write your own logger via "anonymous transactions" (another keyword to use in the docu search)

Share
10 |10000 characters needed characters left characters exceeded