How to extract the current sql inside a trigger.

Sybase 9.

example: Capture the INSERT, UPDATE, DELETE statement.

Extract: INSERT INTO TITLE (ID, ORDER) VALUES (1, 12345).

In higher versions there is the command CURRENT_SQL in Sybase 9 what would be the equivalent command?

asked 02 Dec, 10:54

Hudson%20Leite's gravatar image

Hudson Leite
16223
accept rate: 0%

1

AFAIK SYS_CONTEXT('USERENV','CURRENT_SQL') is an Oracle feature which is only populated when you are using Oracle Fine Grained Auditing (FGA). There is no equivalent feature in SQL Anywhere 9.

The transaction log stores the SQL which caused triggers to fire, but that is not what you are asking for.

You can write code inside your trigger that can deduce what the triggering statement did: action (insert etc), columns, column values etc... but that's a lot of work to achieve what you are asking for.

(02 Dec, 14:16) Breck Carter
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×167
×82

question asked: 02 Dec, 10:54

question was seen: 39 times

last updated: 02 Dec, 14:16