0

Do I need to issue commit command after running the stored function with select query?

1
  • If you are selecting from @dblink then you'd better rollback after that. Commented Apr 25, 2014 at 16:04

3 Answers 3

1

Yes, you do, in some cases (please read the discussion in the link below). The rule is: Always commit if you made change in DB (after DML commands), even with SELECT statement.

Use the COMMIT statement to end your current transaction and make permanent all changes performed in the transaction.

Read more: oracle - what statements need to be committed?

Thanks @Ben for the head up!

Sign up to request clarification or add additional context in comments.

1 Comment

Actually, Oracle considers SELECT to be DML, though Wikipedia states that in SQL 92 SELECT (on it's own) is not DML, as this is in a stored procedure even Wikipedia counts it as DML.
0

commit means "save the changes"

select statement does not change any data.

changing data can be done by Insert, update, delete statements (Data Manipulation language) .

2 Comments

Actually, Oracle considers SELECT to be DML, though Wikipedia states that in SQL 92 SELECT (on it's own) is not DML, as this is in a stored procedure even Wikipedia counts it as DML...
@Ben: ok, we know what DML is. my answer is not contrast with you comment.
0

You need to commit an sql statement only if you have performed a DML statement (INSERT, DELETE, UPDATE, MERGE) in your stored procedure. So, if you only queried the data, there is no need to commit.

1 Comment

Actually, Oracle considers SELECT to be DML, though Wikipedia states that in SQL 92 SELECT (on it's own) is not DML, as this is in a stored procedure even Wikipedia counts it as DML.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.