Is it possible to execute big SQL query in Hibernate?

What is the difference between executing query statements using 'execute' and directy in PL and SQL?

  • st :='SELECT USERNAME FROM LOGIN WHERE USERNAME =: a and PASSWORD =: b'; execute immediate st into un using username,pw;  - or - SELECT USERNAME INTO un FROM LOGIN WHERE USERNAME = username and PASSWORD = pw; where username, un and pw are varchar2(50) variables

  • Answer:

    You can dynamically build a statement string and execute it with EXECUTE statement. When you directly call SELECT .. INTO from PLSQL, such query must be valid at compile time. For example, you can dynamically create a table via EXECUTE, and select from it using EXECUTE again. SELECT .. INTO would fail in this case, as the dynamically created table does not exist yet.

Mustafa Kirac at Quora Visit the source

Was this solution helpful to you?

Other answers

Execute immediate uses late binding..All binding checks done at run time, syntatic n symentic aswell. Early binding otherwise.

Tushar Badyal

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.