Category : oracle12c

Question: I need to retrieve the 1st parameter that has been calculated (SELECT MAX(order_id)+1). CODE int add_order(Connection* conn, int customer_id, int new_order_id) { Statement* stmt = conn->createStatement(); stmt->setSQL("INSERT INTO orders SELECT MAX(order_id)+1, :1, ‘Shipped’, 54, (to_char(sysdate,’dd-mon-yy’)) FROM orders"); stmt->setInt(1, customer_id); ResultSet* rs = stmt->executeQuery(); cout << "Before" << new_order_id << endl; // Test new_order_id = ..

Read more