1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include "ocilib.h"
int main(void)
{
OCI_Connection *cn;
OCI_Statement *st;
int code;
int i;
if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT))
return EXIT_FAILURE;
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
st = OCI_StatementCreate(cn);
OCI_Prepare(st, "delete from test_fetch where code = :code");
OCI_BindInt(st, ":code", &code);
for (i = 0; i < 10; i++)
{
if ((i%2) == 0)
{
/* 4 facons différentes d'indiquer que code est NULL */
OCI_SetNull(stmt, 1);
OCI_SetNull2(stmt, ":code");
OCI_BindSetNull(OCI_GetBind(stmt, 1));
OCI_BindSetNull(OCI_GetBind2(stmt,":code"));
}
OCI_Execute(st);
}
OCI_Commit(cn);
OCI_Cleanup();
return EXIT_SUCCESS;
} |
Partager