What does this mean? (java,database)

 StringBuffer sql = new StringBuffer("{ call ? := mailmerge_package.getLetters(?, ?, ?)}");

I know it's like an sql statement but theres no such thing as 'call' in SQL.

Can someone explain to me what it means and how does it come to be understood by Java

EDIT:

import oracle.jdbc.driver.OracleTypes;
//omitted code
CallableStatement cs = null;
        ResultSet rs = null;
     StringBuffer sql = new StringBuffer("{ call ? := mailmerge_package.getLetters(?, ?, ?)}");
 try {
            cs = conn.prepareCall(sql.toString());
            cs.registerOutParameter(1, OracleTypes.CURSOR);
            DAOUtils.setLong(cs, 3, checklistAnsMastId);
            DAOUtils.setLong(cs, 2, workEntityId);
            cs.setLong(4, patientId);
            DAOUtils.setLong(cs, 5, encounterId);
            cs.setString(6, encounterType);
            cs.execute();
            rs = (ResultSet)cs.getObject(1);

Answers


{call <<procedure name>>}

is a SQL escape sequence. Basically, since different databases have different syntax for how to call a user-defined procedure and different databases have different built-in functions for various things like common date/ time functions, JDBC drivers implement a number of escape sequences where the driver translates a generic specification (i.e. {call <<procedure name>>}) and expands that to be the database-specific syntax. There are various other escape sequences for things like outer joins, date literals, and string functions that can be useful if you're trying to write database agnostic code.

FYI, these escape sequences were originally defined in the ODBC API and then adopted by JDBC so you may find more documentation related to ODBC than JDBC.


This looks like SQL you can pass to Oracle.

If so then this could be used to call an Oracle function mailmerge_package.getLetters which returns a value. That value is parsed by JDBC and the Db layer to replace the first ?, this can be read into a Java variable. the Oracle function takes 3 parameters (the 3 ? in parentheses)


Need Your Help

Which tools or libraries support execution of containment queries for trees?

search graph tree xquery

I've been developing an implementation of a containment query language with quite limited documentation and no reference implementation to use as a guide.

Check if an element is closed using a discrete tag with JavaScript

javascript html dom nodes

I am getting the child nodes of en element and i want to check if the tags can actually contain text. For example:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.