CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Calling Stored Procedures From an Event

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.