How to call parameters for a procedure of a table?
Hello worldI use the oracle 11.1.0.6 version.
I have a procedure that must call 6 parameters in a table. Could I know how to perform the procedure parameters in a table?
Now, I'm running a .sql file.
SELECT TO_CHAR(SYSDATE,'DD/MM/YY hh24:mi:ss') FROM DUAL;
EXEC call_all (201208, 'DBC', 2, 'Choice', 201223, 201236);
Thanks in advance
How do you get the values of the parameters to pass to the CALL_ALL procedure?
If you want to get all the parameters to pass to CALL_ALL, to be taken from the table, you will need to do so in an anonymous PL/SQL block/function/stored procedure as below:
declare
v_bmonth param.bmonth%type;
.
.
.
v_tweek_2 param.tweek_2%type;
begin
select bmonth, ssc, label, tweek_1, tweek_2
into v_bmonth, ..., v_tweek_2 ---> ... corresponds to Individual Parameter variable
from param p
where p.some_column = some_value ---> This condition should be able to fetch only One row from table, else it will throw error.
call_all(v_bmonth, ... v_tweek_2);
end;
------Alternative-------------------
declare
v_param param%rowtype;
begin
select *
into v_param
from param p
where p.some_column = some_value ---> This condition should be able to fetch only One row from table, else it will throw error.
call_all(v_param.bmonth, ... v_param.v_tweek_2); ---> ... corresponds to v_param."Column_Name" for corresponding column names.
end;
Just read that you want to run the procedure for all values:
begin
for cur in (select * from param) loop
call_all(cur.bmonth, ... cur.v_tweek_2);
end loop;
end;
I want to do it in a simpler way:
create or replace function f_execute_call_all
(
b_bmonth in number,
b_banner_name in varchar2,
b_ssc in number,
b_label in varchar2,
b_tweek_1 in number,
b_tweek_2 in number
)
return number is
begin
call_all(bmonth,banner_name,ssc,label,tweek_1,tweek_2);
return 1;
exception
when others then
-- Log Exception Message
raise;
end;
calling Code:
select f_execute_call_all(bmonth,banner_name,ssc,label,tweek_1,tweek_2) from param;
Tags: Database
Similar Questions
-
How to get data in the procedure after CREATE TABLE table1 AS SELECT * from table2
Hello
can any body tell me how to get the data in the new table created in the procedure. because it gives following error.
- Error (47,21): PL/SQL: ORA-00942: table or view does not exist
tableName: = "BCKUP_" | TO_CHAR (sysdate, 'ddmmrrrr');
tableDDL: = 'CREATE TABLE' | tableName. "AS SELECT * FROM Table1 where to_char(MSG_IN_TIME,''dd-mon-rrrr'') < sysdate - ' | daysNumber;
EXECUTE IMMEDIATE backUpDDL;
COMMIT;
DELETE FROM Table1;
How to select the data in the newly created table. as...
Select * from ". tableName;
Do not choose anything to get the number...
Just after backupDDL EXECUTE IMMEDIATE, simply refers to SQL % ROWCOUNT - who will be the number of lines.
Oh and DDL engages automatically, your commitment is redundant.
-
How to call a pl/sql procedure to an event handler in NetBeans IDE
I want to call a procedure from a button click event handler in NetBeans and also pass a parameter to the procedure. How I have here a this?
Wrong forum!
This question belonged to a NetBeans forum.
Please mark the thread ANSWERED and repost in a forum for details.
-
Process 1 gr 2 OWB flow - how to pass parameters to a procedure
Hello
In 10.1 OWB processflow IN procedure parameters can be passed in the activity view that appears on the choice of the procedure within the processflow. How to enter the parameters IN the case of OWB11gr2. In property inspector no options are there. Any help is much appreciatedHello
Select the processing activity. In the structure window, select the parameter. Then, you can set the binding or the value in the Properties window.
Sometimes the property window is not updated when the setting is selected. Double-click the bar from the window of the property window to maximize.
Kind regards
Carsten. -
Create parameters for the WriteData function
Hello
How would create parameters for the writedata function to populate the html code?
CODE:
Function GetCluster {}
and {{foreach ($Datacenter (Get-Data Center))
foreach ($Cluster in (Get-Cluster-location $Datacenter)) {}
New-Object PSObject-property @ {} TypeName
vCenter = $Datacenter.Uid.Split("@") [1]. Split(":") [0]
Datacenter = $Datacenter.Name
Cluster = $Cluster.Name
HAEnabled = $Cluster.HAEnabled
DrsEnabled = $Cluster.DrsEnabled
DrsMode = $Cluster.DrsMode
}
}
}
# Function compiles the data transmitted by the GetCluster function in HTML table format
Function writedata {
param ($vCenter, $Datacenter, $Cluster, $HAEnabled, $DrsEnabled, $DrsMode)
# < td > < Center > < b > < of police = "Tahoma" > $Datacenter < / police > < / b > < / center > < table
{$tableEntry = "< tr > < td > < font ="Tahoma">$vCenter< / fonts > < table > < td > < Center > < b > < of police ="Tahoma">$Datacenter< / font > < / b > < / center > < table > < td > < Center > < b > < of police ="Tahoma">$Cluster< / fonts > < / b > < / center > < table > < td > < Center >"} < b > < of police = "Tahoma" >$HAEnabled< / fonts > < / b > < / center > < table < td > < Center > < b > < font = "Tahoma" >$DrsEnabled< / police > < / b > < / center > < table < td > < Center > < b > < font = 'Tahoma' color 'dark blue' = >$DrsMode< / fonts > < / b > < / center > < table > < /tr ' > '.
Add-Content, $fileName $tableEntry
Write-Host $tableEntry}Thank you
You specify when you call the writedata function, so I guess it's in the function Get-Cluster.
You can pass the object you create in the GetCluster function as a parameter.
Try something like this
Function GetCluster { & { foreach ($Datacenter in (Get-Datacenter)) { foreach ($Cluster in (Get-Cluster -Location $Datacenter)) { $clusObj = New-Object -TypeName PSObject -Property @{ vCenter = $Datacenter.Uid.Split("@")[1].Split(":")[0] Datacenter = $Datacenter.Name Cluster = $Cluster.Name HAEnabled = $Cluster.HAEnabled DrsEnabled = $Cluster.DrsEnabled DrsMode = $Cluster.DrsMode } writedata $clusObj } } } } # Function will compile the data passed from the GetCluster Function into HTML table format Function writedata { param ($object) $tableEntry = "
" Add-Content $fileName $tableEntry Write-Host $tableEntry}$($object.vCenter) " + " " + "$($object.Datacenter) " + "$($object.Cluster) " + "$($object.HAEnabled) " + "$($object.DrsEnabled) $($object.DrsMode) -
How to call PL/SQL function processRequest
Hello
I'm trying to run a function called xxhr_trg_evaluation_pkg.xx_get_class_desc (1);
How can I run the above inside the processRequest function and pass the value returned in a variable string.
Thanks in advance
Kind regards... AshrafAshraf,
The following code will help you how to call the function or procedure in processRequest.
processRequest Code:
{} public processRequest Sub (pageContext OAPageContext, OAWebBean webBean)
Oaam = pageContext.getApplicationModule (webBean) OAApplicationModule;
OADBTransaction dbtrans;
TXN OADBTransaction = (OADBTransaction) oaam.getOADBTransaction ();statement that even execute the statement as pl/sql in Toad
= Txn.createCallableStatement cs CallableStatement ("start: 1: = xxhr_trg_evaluation_pkg.xx_get_class_desc (: 2); end;", 0);variable will contain the return value
String outputVal ="";pass the value of the entry to the callable statement
try {}
cs.setString(2,1+"");}
catch (Exception e) {}
}try {}
CS. Execute();
outputVal = cs.getString (1);
}
catch (Exception e) {}
}try {}
CS. Close();
}
catch (Exception e) {}
}
Did all the insert/update/etc means do validation of here too but you did not engage in the service by using the following syntax
dbtrans.Commit ();}
Thank you
SAN -
How to call oracle forms report using parameterlist for parameters
Dear all,
I want to know how to call oracle forms report and parameter passing between the report and the form with the list of parameters?
can someone help me?What research? The forum is full of examples.
-
How to call a stored procedure with a REF CURSOR output parameter
I'm looking forward to example calling a function/stored procedure with a REF CURSOR output parameter and get the result.
In other words, I have a stored function/procedure that runs a SELECT statement using the OCI library and then he could get the values of each row and each column.
I put a code snippet, it have only the main thing to call a simple stored procedure and to print the name of each column of the cursor, but I couldn t to print out values in the table that calls the stored procedure.
I understand that the next step is to call an OCIStmtFetch.
How to associate the slider with the OCIStmtFetch?
If you need more information, just tell me.
I use ANSI C with HP - UX (HP - UX C) operating system and Oracle 10 g.
Kind regards.
Antonio Garcia
/ * callOracleSP * /.
#include < stdio.h >
#include < string.h >
#include < oci.h >
#include < stdlib.h > to
char * pConnectChar = "Server";
char * pUsernameChar = "user";
char * pPasswordChar = "passwd";
char * sqlCharArray1 = "BEGIN SP_GETCITIES (:,: c); END; « ;
int retval;
UB4 parmcnt = 0;
UB4 pos2 = 0;
text * pcoln [20];
UB4 namelen [20];
char state_key [5];
OCIStmt * pOciStatement;
OCIStmt * pOciStatCursor;
OCIError * pOciError;
OCIEnv * pOciEnviron;
OCIServer * pOciServer;
OCISession * pOciSession;
OCISvcCtx * pOciServiceContext;
OCIBind * pOciBind [500];
OCIParam * pOciParam;
int main()
{
retval = OCIEnvCreate (& pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL, 0, NULL);
retval = OCIEnvInit (& pOciEnviron, OCI_DEFAULT, 0, NULL);
retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciError, OCI_HTYPE_ERROR, 0, NULL);
retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciStatement, OCI_HTYPE_STMT, 0, NULL);
retval = OCILogon (pOciEnviron, pOciError, & pOciServiceContext,(unsigned char *) pUsernameChar,
strlen (pUsernameChar), (unsigned char *) pPasswordChar, strlen (pPasswordChar).
(unsigned char *) pConnectChar, strlen (pConnectChar));
printf ("retval=%d\n",retval OCILogon);
retval = OCIStmtPrepare (pOciStatement, pOciError, (unsigned char *) sqlCharArray1, strlen (sqlCharArray1),)
OCI_NTV_SYNTAX, OCI_DEFAULT);
printf ("StmtPrepare retval=%d\n",retval);
retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
retval = 1 OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4), (void *) & state_key,)
((sb4) sizeof (state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
printf ("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *) & pOciStatCursor,)
((sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
printf ("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
strcpy (state_key, 'ca');
retval = OCIStmtExecute (pOciServiceContext, pOciStatement, pOciError, (ub4) 1, (ub4) 0,)
(OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT (ub4));
printf ("StmtExecute retval=%d\n",retval);
/ * How to get the values of the cursor? */
/ * Number of parameters of the cursor * /.
OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & parmcnt,(ub4 *) 0,)
(ub4) (OCI_ATTR_PARAM_COUNT, pOciError);
printf ("\nNumber of the slider settings = %d\n",parmcnt);
for (int pos = 1; pos < = (int) parmcnt; pos ++)
{
OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & pos2,(ub4 *) 0,)
(ub4) (OCI_ATTR_CURRENT_POSITION, pOciError);
retval = OCIParamGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), pOciError, (void *) & pOciParam,)
POS (ub4));
OCIAttrGet pOciParam, (ub4) ((void*) OCI_DTYPE_PARAM,(void*) & pcoln [pos - 1],(ub4 *) & namelen [pos-1],)
(ub4) OCI_ATTR_NAME,(OCIError *) pOciError);
}
for (int i = 1; i < = (int) parmcnt; i ++)
printf ("%i\tNAME = % column. ("* s\n", i, namelen [i-1], pcoln [i-1]);
return 0;
}
This is the script that create the table, insert records and create the stored procedure
CREATE TABLE CITIES)
STATE_CODE VARCHAR2 (2) NULL,
CITY_CODE NUMBER (15.5) NULL,
CITY_NAME VARCHAR2 (30) NULL
)
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('CA', 30, 'SAN DIEGO')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('CA', 40 'SACRAMENTO')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('FL', 10, 'MIAMI')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('FL', 20, 'ORLANDO')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('NEW YORK', 10, 'NEW YORK')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('NEW YORK', 20, 'ALBANY')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('CA', 10, 'LOS ANGELES')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('CA', 20, 'SAN FRANCISCO')
/
CREATE or REPLACE PACKAGE globalPkg AUTHID CURRENT_USER AS
/ * The following is specific global variables T/SQL. */
TYPE RCT1 IS REF CURSOR; / * new cursor low definition * /.
END globalPkg;
/
CREATE OR REPLACE PROCEDURE SP_ADDCITY)
P_STATE_CODE IN VARCHAR,
P_CITY_CODE NUMBER,
P_CITY_NAME IN VARCHAR2,
P_RETURN IN NUMBERS)
AS
StoO_error INTEGER;
StoO_selcnt INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2 (255);
BEGIN
StoO_rowcnt: = 0;
StoO_error: = 0;
StoO_selcnt: = 0;
P_RETURN: = 0;
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES (P_STATE_CODE, P_CITY_CODE, P_CITY_NAME);
StoO_rowcnt: = number of LINES SQL %;
EXCEPTION
WHEN TOO_MANY_ROWS THEN
StoO_rowcnt: = 2;
WHILE OTHERS THEN
StoO_rowcnt: = 0;
StoO_selcnt: = 0;
StoO_error: = SQLCODE;
StoO_errmsg: = SQLERRM;
IF StoO_error! = 0 THEN
BEGIN
P_RETURN: = 1;
RETURN;
END;
END IF;
END;
/
CREATE OR REPLACE PROCEDURE SP_GETCITIES)
STATE_KEY IN VARCHAR,
RC1 IN OUT globalPkg.RCT1)
AS
StoO_error INTEGER;
StoO_selcnt INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2 (255);
BEGIN
StoO_rowcnt: = 0;
StoO_error: = 0;
StoO_selcnt: = 0;
OPEN FOR RC1
SELECT STATE_CODE, CITY_CODE, FRANCISCO
CITIES
WHERE STATE_CODE = STATE_KEY
ORDER BY CITY_CODE;
StoO_rowcnt: = number of LINES SQL %;
EXCEPTION
WHILE OTHERS THEN
StoO_rowcnt: = 0;
StoO_error: = SQLCODE;
StoO_errmsg: = SQLERRM;
END;
/Hi Antonio,.
I see this:
c_buf=(ub1 **)calloc(sizeof(ub1 *),3); ... rc=OCIDefineByPos(pOciStatCursor,&pdef,(OCIError *)pOciError,pos,c_buf[pos-1],size+1,(ub2)type,(dvoid *)c_indp[pos-1],(ub2 *)0,(ub2 *)0,OCI_DEFAULT);
That I don't understand. You allocate space for 3 pointers ub1 but I don't see where these pointers are then initialized to point to where the data is to be stored.
I do not read correctly?
Sorry for posting code long, but here is an example of code that I have. It is much more 'code' for your code, but maybe that will be enough...
NOTE: This is just the code example and not rigorous. For example, I don't check the memory, allocations etc in this code!
Kind regards
Mark
#ifdef WIN32 #define _CRT_SECURE_NO_DEPRECATE 1 #endif #include
#include #include #include void checkerr(sword status, OCIError *errhp); int main(int argc, char *argv[]) { OCIEnv *envhp = NULL; /* OCI Environment handle */ OCIError *errhp = NULL; /* OCI Error handle */ OCISvcCtx *svchp = NULL; /* OCI Service Context handle */ OCIServer *srvhp = NULL; /* OCI Server handle */ OCISession *usrhp = NULL; /* OCI User Session handle */ OCIStmt *stmtp = NULL; /* OCI Statement handle */ OCIStmt *cursr = NULL; /* OCI Statement handle */ OCIParam *prmp1 = NULL; /* OCI Parameter handle */ OCIParam *prmp2 = NULL; /* OCI Parameter handle */ OCIParam *prmp3 = NULL; /* OCI Parameter handle */ OCIDefine *defp1 = NULL; /* OCI Define handle */ OCIDefine *defp2 = NULL; /* OCI Define handle */ OCIDefine *defp3 = NULL; /* OCI Define handle */ OCIBind *bndp1 = NULL; /* OCI Bind handle */ OCIBind *bndp2 = NULL; /* OCI Bind handle */ OCIBind *bndp3 = NULL; /* OCI Bind handle */ /* used to hold column width */ ub2 col_width; /* used to set the prefetch count */ ub4 prefetch_count = 32; /* will hold output from database */ oratext *pEmpId = NULL; oratext *pFirstName = NULL; oratext *pLastName = NULL; /* the anonymous block to execute */ /* this opens a ref cursor */ oratext *sqlstmt = "begin " \ " open :1 for " \ " select to_char(employee_id), " \ " first_name, " \ " last_name " \ " from hr.employees " \ " order by last_name, " \ " first_name; " \ "end;"; /* used to hold the results of each OCI call */ sword result = 0; /* Initialize and create a default environment */ result = OCIEnvCreate(&envhp, OCI_DEFAULT, (dvoid *) 0, 0, 0, 0, (size_t) 0, (dvoid **) 0); /* allocate an error handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &errhp, OCI_HTYPE_ERROR, 0, (dvoid **) 0); /* allocate a service context handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &svchp, OCI_HTYPE_SVCCTX, 0, (dvoid **) 0); /* allocate a server handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &srvhp, OCI_HTYPE_SERVER, 0, (dvoid **) 0); /* allocate a user session handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &usrhp, OCI_HTYPE_SESSION, 0, (dvoid **) 0); /* create a server context using the "ORADEMO" database */ result = OCIServerAttach(srvhp, errhp, "ORADEMO", (ub4) strlen("ORADEMO"), OCI_DEFAULT); /* set the server attribute in the service context handle */ result = OCIAttrSet((dvoid *) svchp, OCI_HTYPE_SVCCTX, (dvoid *) srvhp, (ub4) 0, OCI_ATTR_SERVER, errhp); /* open the session with the database */ /* using external authentication */ result = OCISessionBegin(svchp, errhp, usrhp, OCI_CRED_EXT, OCI_DEFAULT); /* set the user session attribute in the service context handle */ result = OCIAttrSet((dvoid *) svchp, OCI_HTYPE_SVCCTX, (dvoid *) usrhp, (ub4) 0, OCI_ATTR_SESSION, errhp); /* allocate the statement handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &stmtp, OCI_HTYPE_STMT, 0, (dvoid **) 0); /* prepare the statement for execution */ result = OCIStmtPrepare(stmtp, errhp, sqlstmt, (ub4) strlen((char *) sqlstmt), OCI_NTV_SYNTAX, OCI_DEFAULT); /* allocate the handle for the ref cursor */ result = OCIHandleAlloc((dvoid *) envhp, (void **) &cursr, OCI_HTYPE_STMT, 0, NULL); /* bind the ref cursor parameter */ result = OCIBindByPos(stmtp, &bndp1, errhp, 1, &cursr, 0, SQLT_RSET, NULL, 0, NULL, 0, 0, OCI_DEFAULT); /* execute the statement */ result = OCIStmtExecute(svchp, stmtp, errhp, 1, 0, NULL, NULL, OCI_DEFAULT); /* get parameter descriptor for first column */ result = OCIParamGet((dvoid *) cursr, OCI_HTYPE_STMT, errhp, (dvoid **) &prmp1, (ub4) 1); /* get parameter descriptor for second column */ result = OCIParamGet((dvoid *) cursr, OCI_HTYPE_STMT, errhp, (dvoid **) &prmp2, (ub4) 2); /* get parameter descriptor for third column */ result = OCIParamGet((dvoid *) cursr, OCI_HTYPE_STMT, errhp, (dvoid **) &prmp3, (ub4) 3); /* get the first column width in characters */ result = OCIAttrGet((dvoid*) prmp1, (ub4) OCI_DTYPE_PARAM, (dvoid*) &col_width, (ub4 *) 0, (ub4) OCI_ATTR_DATA_SIZE, errhp); /* allocate memory to hold the result */ pEmpId = (oratext *) malloc(sizeof(oratext) * (col_width + 1)); /* define the first column in the results */ result = OCIDefineByPos(cursr, &defp1, errhp, 1, (dvoid *) pEmpId, (sword) col_width + 1, SQLT_STR, (dvoid *) NULL, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT); /* get the second column width in characters */ result = OCIAttrGet((dvoid*) prmp2, (ub4) OCI_DTYPE_PARAM, (dvoid*) &col_width, (ub4 *) 0, (ub4) OCI_ATTR_DATA_SIZE, errhp); /* allocate memory to hold the result */ pFirstName = (oratext *) malloc(sizeof(oratext) * (col_width + 1)); /* define the second column in the results */ result = OCIDefineByPos(cursr, &defp2, errhp, 2, (dvoid *) pFirstName, (sword) col_width + 1, SQLT_STR, (dvoid *) NULL, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT); /* get the third column width in characters */ result = OCIAttrGet((dvoid*) prmp3, (ub4) OCI_DTYPE_PARAM, (dvoid*) &col_width, (ub4 *) 0, (ub4) OCI_ATTR_DATA_SIZE, errhp); /* allocate memory to hold the result */ pLastName = (oratext *) malloc(sizeof(oratext) * (col_width + 1)); /* define the third column in the results */ result = OCIDefineByPos(cursr, &defp3, errhp, 3, (dvoid *) pLastName, (sword) col_width + 1, SQLT_STR, (dvoid *) NULL, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT); /* loop through and print the results */ while ((result = OCIStmtFetch(cursr, errhp, (ub4) 1, (ub2) OCI_FETCH_NEXT, (ub4) OCI_DEFAULT)) == OCI_SUCCESS) { printf("Employee ID: %s\n", pEmpId); printf(" First Name: %s\n", pFirstName); printf(" Last Name: %s\n\n", pLastName); } /* free allocated memory */ free(pEmpId); free(pFirstName); free(pLastName); pEmpId = NULL; pFirstName = NULL; pLastName = NULL; /* terminate the session with the database */ result = OCISessionEnd(svchp, errhp, usrhp, OCI_DEFAULT); /* detach from the server */ result = OCIServerDetach(srvhp, errhp, OCI_DEFAULT); /* deallocate the environment handle */ /* OCI will deallocate the child handles */ result = OCIHandleFree((dvoid *) envhp, OCI_HTYPE_ENV); return OCI_SUCCESS; } void checkerr(sword status, OCIError *errhp) { oratext errbuf[512]; sb4 errcode = 0; switch (status) { case OCI_SUCCESS: break; case OCI_ERROR: case OCI_SUCCESS_WITH_INFO: (void) OCIErrorGet((dvoid *) errhp, (ub4) 1, (oratext *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); (void) printf("Error: %.*s\n", sizeof(errbuf), errbuf); break; case OCI_NEED_DATA: (void) printf("Error - OCI_NEED_DATA\n"); break; case OCI_NO_DATA: (void) printf("Error - OCI_NO_DATA\n"); break; case OCI_INVALID_HANDLE: (void) printf("Error - OCI_INVALID_HANDLE\n"); break; case OCI_STILL_EXECUTING: (void) printf("Error - OCI_STILL_EXECUTING\n"); break; case OCI_CONTINUE: (void) printf("Error - OCI_CONTINUE\n"); break; default: break; } } -
How to call the PL/SQL of EntityImpl procedure
Hello
I have a page that can create/update visitors. When a new customer is created themselves, a line gets inserted into the database table. I use EO for this feature.
I need to create lines to two or three other table also when a new line is created in the main table. What is the best practice for this feature?
The 2 options that I know:
1 create a trigger on the main table and the appeal of trigger for inserting rows in other tables.
2. call a PL/SQL of EntityImpl procedure after the permanent data is committed to the table. (If this is the best approach, could you please let me know how to get there)
See you soon
AJ
In fact, Java Mail API is included in WLS and JDev, then you can simply add %MIDDLEWARE_HOME%\Oracle_Home\oracle_common\modules\javax.mail_2.0.0.0_1-4-4.jar to your project.
Dario
-
How to call the procedure type table
Hi I have the below requirement
Created in the sub table type
CREATE or REPLACE the TYPE char_type IS the TABLE OF VARCHAR2 (4000);
create or replace procedure test_proc_type (p_type char_type) is
Start
I'm looping 1.p_type.count
dbms_output.put_line (p_type (i));
end loop;
end;
How to call the procedure with parameter as a type!
SQL> create or replace type char_type as table of varchar2(4000) 2 / Type created. SQL> create or replace procedure test_proc_type (p_type char_type) 2 is 3 begin 4 for i in 1..p_type.count loop 5 dbms_output.put_line (p_type(i) ) ; 6 end loop; 7 end; 8 / Procedure created. SQL> set serveroutput on SQL> SQL> exec test_proc_type(char_type('A','B','C','D','E')) A B C D E PL/SQL procedure successfully completed. SQL>
-
Simple question-how to call a stored procedure or function of apex?
Simple question-how to call a stored procedure or function of apex?
Thanks advance.
DougHi Doug,.
You can call a procedure or function of apex. It depends on what you want to do with the function or procedure. If you want to retrieve table data in a specific area, you can try something like this-The following statement creates the function get_bal on the oe.orders of sample table (PL/SQL is in italics):
CREATE FUNCTION get_bal (acc_no in NUMBER)
RETURN NUMBER
IS acc_bal NUMBER (11.2);
BEGIN
SELECT order_total
IN acc_bal
Orders
WHERE customer_id = acc_no;
Return (acc_bal);
END;
/The function created in the previous example can be used in a SQL statement. For example:
SELECT get_bal (165) FROM DUAL;
GET_BAL (165)
------------
2519hope this will help,
Kind regards
Pascal M
http://Tajuddin.whitepagesbd.com -
How can I know for sure if this is call microsoft?
How can I know for sure if it's microsoft appeal is there a specific question I can ask? Once again thank you.
I never ever ever heard the call of a client of Microsoft. There are millions of customers, why they call any particular customer. Actually how they know it a phone number.
-
Hi friends I want to know how to call a procedure that has values arrary as parameter?
I have a procedure as shown below, and I am using oracle 11g.
create or replace procedure procedureName (v_hospital_id in NUMBER,
v_process_id VARR_VARRY,
v_cnt OUT NUMBER);
Now, how to call this procedure from PLSQL. If v_process_id values ('abc123', 'xyz234', 'sfs234')
Please present the definition of VARR_VARRY
If it's a simple table of varchar2.
declare
v_cnt NUMBER;
Start
procedureName (1, VARR_VARRY('abc123','xyz234','sfs234'), v_cnt);
end;
-
How to call a stored procedure PL/SQL of the Disqualification?
I figured I could do this from a Groovy script but I am unable to make it work.
Let's take the simplest scenario:
At the end of a job, I have a need to call an once stored procedure that has no arguments.
Translated by the logic of the stored procedure with Disqualification is not an option.
If you must call it once at the end of a task, you must use the external task.
If you call a procedure for each record, it can be done using a script.
-
How to call the procedure on the page of the ofa
Hi all
I have a button.when I click this button need to call the procedure and should return the values.i tried with below code.am is error.i am passing two parameters to the procedure.please suggest me where I made a mistake in the code.
code in am
-------------
public String calprorate (String laseid, String billingid)
{
OADBTransaction oadbtransaction = (OADBTransaction) getTransaction ();
OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl) getTransaction ();
String retValues;
System.out.println ("number:" + laseid);
StringBuffer str = new StringBuffer();
Str.Append ("BEGIN");
Str.Append (LEASE_PRORATE_PKG ".") LEASE_PRORATE_PROC1 (»);
Str.Append ("p_lease_id = >: 1");
Str.Append ("p_billing_id = >: 2");
Str.Append ("P_PRORATE = >: 3");
System.out.println ("params");
Str.Append (»); «) ;
Str.Append ("END");
System.out.println ("End");
OracleCallableStatement oraclecallablestatement =
(OracleCallableStatement) oadbtransaction.createCallableStatement (str.toString (), 1);
System.out.println ("Oracle");
try {}
oraclecallablestatement.setString(1,laseid);
oraclecallablestatement.setString(2,billingid);
oraclecallablestatement.setInt (1, Integer.parseInt (laseid));
oraclecallablestatement.setInt (2, Integer.parseInt (billingid));
System.out.println ("param");
oraclecallablestatement.registerOutParameter (3, Types.VARCHAR);
System.out.println("3");
oraclecallablestatement. Execute();
System.out.println ("exe");
retValues = oraclecallablestatement.getString (3);
}
catch (System.Exception e)
{
System.out.println ("delivery");
throw OAException.wrapperException (e);
}
Return retValues;
System.out.println ("End");
}
code co:
-------------
If (pageContext.getParameter ("Calc")! = null) {}
Vo1 OAViewObject = (OAViewObject) am.findViewObject ("AddonBillingVO");
System.out.println ("VO");
{if(VO1!=null)}
CNT int = vo1.getRowCount ();
System.out.println ("count:" + cnt);
If (cnt > 0)
{
RowSetIterator rs = vo1.createRowSetIterator("empIterator");
System.out.println ("EMP");
If (rs! = null)
{
While (rs.hasNext ())
{
AddonBillingVORowImpl line = rs.next ((AddonBillingVORowImpl));
System.out.println ("impl");
If (line! = null)
{
String laseid = row.getAttribute("LeaseId").toString ();
System.out.println (laseid);
String billingid = row.getAttribute("AddonBillingId").toString ();
[Serializable] param = {}
laseid, billingid
};
String newupc = (String) am.invokeMethod ("calprorate", param);
}
}
Khalil.
You can paste your spec procedure here?
Also see: Oracle tips of Johny: OAF: sample code to call the PL/SQL of OA Framework procedure
Maybe you are looking for
-
Firefox has been installed in my desktop PC. Then I bought an Android phone, and I've synced it to my computer.Now I have no access to my PC and I bought a laptop that I want to also synchronize, but the only device available to do the sync is my And
-
L755-154 satellite - could not get WiFi to work
Hello I have a Satellite L755-154 runs a new copy of Windows 7, but I can't get the WIRELESS to work at all. Someone at - it a link to the drivers concerned? (Windows 7 64-bit) I don't see any network adapter wireless device settings? just the Ethern
-
When printing, in this case the documents double faces, text on some pages is missing either at the top or bottom of the page, this also happens with diagrams. the fault is irregular on each document page multi on some copies, that the fault is on an
-
PsExec.exe Runing on labview2012 with Exec.vi system
I have problem on this, it will signal erroe to run PsExec.exe using the 'Exec.vi system'. It works well on the Labview8.6 version, but has problems on Labview2012. Could someone help?
-
Outlook Express does not display photos and I can't click on the links
Outlook Express problems I get e-mails with alerts from organizations that allow me to just click on the button "Take Action" and it takes me to another site where I can fill in the form. My Outlook Express no longer allows me to do. I also can't s