Вы можете использовать CallableStatement
String sql="begin ? := aaaa.fucntion(?,?); end;";
CallableStatement stmt = connection.prepareCall(sql);
stmt.registerOutParameter(1, OracleTypes.BOOLEAN);
stmt.setInt(2, number);
stmt.setTimestamp(3, date);
stmt.execute();
. После этого вы можете прочитать возвращаемое значение с помощью:
stmt.getBoolean(1)
There's one more (at least) road to Rome:
static const char HELLO3[] = "Howdy";
(static
— optional — is to prevent it from conflicting with other files). I'd prefer this one over const char*
, because then you'll be able to use sizeof(HELLO3)
and therefore you don't have to postpone till runtime what you can do at compile time.
The define has an advantage of compile-time concatenation, though (think HELLO ", World!"
) and you can sizeof(HELLO)
as well.
But then you can also prefer const char*
and use it across multiple files, which would save you a morsel of memory.
In short — it depends.
Одно преимущество (хотя и очень небольшое) определения строки константы в том, что вы можете объединить их:
#define HELLO "hello" #define WORLD "world" puts( HELLO WORLD );
Не уверен, что это действительно преимущество, но это метод, который нельзя использовать с const char *.
Основным недостатком метода #define является то, что строка дублируется каждый раз, когда она используется, поэтому вы можете получить множество ее копий в исполняемом файле, что сделает его больше.