Deke
|
| Posted: 04/07/2005, 8:47 AM |
|
I am trying to call a stored procedure named foo() with parameters.
How can I set up and execute call to a oracle stored procedure withing the following CCS afterinsert event?
THanks!
//BM_SECORDR_AfterInsert @2-346FBE4B
function BM_SECORDR_AfterInsert()
{
$BM_SECORDR_AfterInsert = true;
//End BM_SECORDR_AfterInsert
//Custom Code @30-3B8B6D43
// -------------------------
global $BM_SECORDR;
// Write your own code here.
// -------------------------
//End Custom Code
//Close BM_SECORDR_AfterInsert @2-43CB9973
return $BM_SECORDR_AfterInsert;
}
//End Close BM_SECORDR_AfterInsert
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 04/08/2005, 1:49 AM |
|
Deke,
Execute Stored Procedure in the same manner as custom SQL, i.e. use query() function.
_________________
Regards,
Nicole |
 |
 |
glerma
Posts: 56
|
| Posted: 04/24/2005, 10:44 AM |
|
Hi Nicole,
Can you elaborate further on your answer please?
I too need to execute a stored procedure from a Custom Code event.. I am having problems formatting the execution of the stored procedure so that it executes correctly.
Here is what I am trying to do.
Execute a SP to Insert rows into a single table. The reason why I need to insert this manually using custom coding is because one of the values that needs to be entered is coming from a Multiple selection ListBox object, thus I cannot use the IDE to build my call to the SP. If I do so, only the first selection will be inserted. I need it to insert all values selected. What I have done instead is selected a Custom Code Event from the OnClick Server event for the form Submit Button. I then perform a loop on the POST variable for the Select ListBox:
Example:
foreach ($_POST['listedVcategories'] as $value) {
…
}
What I need to do within the loop is call my SP.
Here is the SP ( I am using Oracle)
/**
* ORACLE PROCEDURE add_vend_bus_cat
*
* For saving a selected Vendor Business Category.
* this procedure inserts a row into the ORG_VENDOR_CAT_ASSIGN
* table containing the org_id and vendor_cat_id.
*
* @author GLerma <glerma@iqmail.net>
* @project MFC Website
* @copyright Multifamily Central, L.L.C.
*/
PROCEDURE ADD_VEND_BUS_CAT(
ORG_ID_IN IN ORG_ACCOUNTS.ORG_ID%TYPE,
VENDOR_CAT_ID_IN IN ORG_VENDOR_CATEGORIES.VENDOR_CAT_ID%TYPE
)
IS
BEGIN
INSERT INTO ORG_VENDOR_CAT_ASSIGN (ORG_ID,VENDOR_CAT_ID) VALUES (ORG_ID_IN,VENDOR_CAT_ID_IN);
END;
My current problem is figuring out how to call the SP within my loop, while using the existing CCS Database Abstract API. How do I bind my variables to the SP? Do I call the PHP OCIBindByName or do I use the function built into the db_oci8.php file included with the CCS API? This is my dilemma. Any assistance or guidance would be tremendously helpful.
Once again, here is my summary:
Intent: Using Custom Code, Insert one or many rows of data into a single table from a Multiple Selection Listbox object.
Table Properties:
Table Name:
Vendor_cat_assign
Columns:
org_id
vendor_cat_id
Event to call SP:
Form->Button->Server->OnClick
Regards,
George
|
 |
 |
|