Object type variable - Help !
Hi
I want to achieve following outcome:
Create a object type e.g.
CREATE TYPE employees AS OBJECT (
employee_id NUMBER(6),
first_name VARCHAR2(20)
Then create a table type e.g
CREAT TYPE emp_table AS TABLE of employees;
So far so good.
Now I want to declare a variable of emp_table type in my
procedure and then populate it using a select clause.
Something like this:
my_employees emp_table;
insert into my_employees select id, name from table1 where id < 50;
Where table1 is some permanent table in my database.
I am not able to figure out how to achieve this.
I dont want to create a permanent table in my database for this.
I want to keep this table type variable in memory and discard it at the end
of the procedure.
Please help
Regards
Madhup
BULK COLLECT INTO
http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#28329
SQL> CREATE TYPE employees AS OBJECT (
2 employee_id NUMBER(6),
3 first_name VARCHAR2(20)
4 );
5 /
Type created.
SQL> CREATE TYPE emp_table AS TABLE of employees;
2 /
Type created.
SQL> declare
2 my_employees emp_table := emp_table();
3 begin
4 select employees(empno,ename) bulk collect into my_employees from emp;
5 end;
6 /
PL/SQL procedure successfully completed.Rgds.
Similar Messages
-
Assign value to Object type variable
CREATE OR REPLACE TYPE emp AS OBJECT (
empid NUMBER,
age NUMBER,
dob date);
CREATE OR REPLACE TYPE emp _tab AS TABLE OF emp;
Pls hlep me assign value to the object type variable in loop..(assume there is 5 10 records in emp table)
declare
v_emp_tt emp _tab ;
begin
for i in (select empid ,age ,dob from emp ) Loop
v_emp_tt := i.empid; --this is wrong pls help me correct it.
end loop;
end;
thanks,I would keep the type/object naming convention distinct from the table name.
In terms of assignment:
CREATE OR REPLACE TYPE to_emp AS OBJECT
(empid NUMBER,
age NUMBER,
dob date);
CREATE OR REPLACE TYPE tt_emp AS TABLE OF emp;
declare
v_emp tt_emp;
begin
select to_emp_obj(emp_id, age, dob)
bulk collect into v_emp
from emp;
end; -
How can I obtain an object-type variable in Forms 6i?
i create an object-type in oracle 8i database like this:
TYPE OBJ_TYPE_NUMBER AS OBJECT
FIELD1 NUMBER,
MEMBER PROCEDURE INIT, ...
i create a variable of this object-type in a stored procedure in Oracle 8i:
v_Number OBJ_TYPE_NUMBER(10);
and then call it's method:
v_Number.INIT;
it work's!
But when I try to compile a previous variable declaration
(v_Number OBJ_TYPE_NUMBER;) in Oracle Forms 6i I see only an error message.
So my question is How can I declare and use an object-type variable in Forms 6i?Hi,
the release after Forms 6i is Forms9i. Forms9i does have the PLSQL engine of Oracle 9.0.0.2 database which means that it should knwo how to handle object types in PLSQL.
Frank -
What target property must be specified while passing a object type variable to child package in SSIS 2012???
As shown below, there is variable strVar and it's Value property is selected. Likewise you have to select the property that you need to pass.
Please refer:
http://www.bidn.com/blogs/MikeDavis/ssis/155/passing-variable-values-from-parent-package-to-child-ssis
-Vaibhav Chaudhari -
SSIS 2012 - Parent/Child Package "Object" Type Variables
How do I pass Variables of Object type from Parent to Child packages?
I am using the SSIS 2012 project deployment model.
ThanksYou can do it as outlined in
http://sqlblog.com/blogs/andy_leonard/archive/2010/01/25/ssis-snack-passing-parent-starttime-to-the-child-package.aspx
But
When you need an object it is typically a recordset, then just pass the results, or execute the query in a package.
Arthur My Blog -
Cannot query varray of object types-please help
I am attempting to query the "diminfo" field of the view "MDSYS.all_sdo_geom_metadata". The field is "described" as MDSYS.SDO_DIM_ARRAY, which I believe is a varray of MDSYS.SDO_DIM_ELEMENT.
I have run OTT to generate the class files, but nothing is generated for the MDSYS.SDO_DIM_ARRAY "type" (maybe because it's not really a type?). A class is generated for the SDO_DIM_ELEMENT objects.
Anyway, I have tried to query the field using both "VALUE(diminfo)" and "REF(diminfo)":
select VALUE(diminfo) from all_sdo_geom_metadata;
- or -
select REF(diminfo) from all_sdo_geom_metadata;
and I get back an ORA-904 "invalid identifier". When I remove the "VALUE" or "REF" from the query, the error goes away, and is replaced by an ORA-32162 "Read/Write method not registered" further down in the code when I try to retreive the value from the recordset:
myDimInfo = rSet->getObject(1);
Since the field type (MDSYS.SDO_DIM_ARRAY) isn't really an object type, I can see why the "Read/Write method not registered" occurs-there are no methods to register.
Can someone provide a code snippet of how to perform this query?
Thanks in advanceHi,
I am using OTT generated objects to pass them to my PL/SQL procedures as OUT parameters. When I call the registerOutParam() function, I get this error ORA-32162: Read/Write SQL method not registered.
I am calling my mapping function after creating environment and before creating my stateless connection pool. But still I am getting this exception at runtime while calling registerOutParam().
Environment* env;
env = Environment::createEnvironment(Environment::OBJECT);
MessageTOMapping(env); // Calling the mapping function here.
// Creating the stateless connection pool.
StatelessConnectionPool* scp;
scp = env->createStatelessConnectionPool("naveen",
"naveen",
"//10.105.153.11:1521/pls",
10,
5,
2,
StatelessConnectionPool::HOMOGENEOUS);
// Fetch a connection from the stateless connection pool
conn = scp->getConnection();
// After this, I create my Statement and call the registerOutParam() which
// causes ORA-32162 exception.
Please note that I do not get this error when I don't use any connection-pooling mechanism. That is, if I create an environment in OBJECT mode, call the mapping function with its pointer and create a normal Connection object (without any pooling etc), my application runs perfectly fine. E.g. if I replace the above piece of code with the code below, my application runs fine.
Environment* env;
env = Environment::createEnvironment(Environment::OBJECT);
MessageTOMapping(env); // Calling the mapping function here.
conn = env->createConnection("naveen", "naveen", "//10.105.153.11:1521/pls");
// After this, I create my Statement and call the registerOutParam() which
// does not give problem now and my application runs pefectly fine.
Can anyone let me know what I am doing wrong while using the stateless connection pooling mechanism? I definitely need to use Stateless Connection Pooling and must not get connections directly from env->createConnection().
Any help will be greatly appreciated.
Thanks and Regards,
Naveen -
JBO-25005: Object name 1 for type Variable is invalid(help please)
Hi Guys,
when i connect my application to the DB locally, everything works fine. however, once i deploy my application to the server by connecting to the same DB, i tried 10 users which i already tested loaclly and work fine,
i got the following problem:
all of 10 users are able to access to any pages on the web application, except when one of the users tries can not access one specific page, i got the following error:
500 Internal Server Error
JBO-30003: The application pool (ca.bluecross.ab.eca.model.services.ECAServiceLocal) failed to checkout an application module due to the following exceptionracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.InvalidObjNameException, msg=JBO-25005: Object name 1 for type Variable is invalid at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2002) at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1998) at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:2793) at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:453) at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:233) at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:424) at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:419) at oracle.adf.model.bc4j.DCJboDataControl.rebuildApplicationModule(DCJboDataControl.java:1517) at oracle.adf.model.bc4j.DCJboDataControl.beginRequest(DCJboDataControl.java:1381) at oracle.adf.model.BindingContext.beginRequest(BindingContext.java:683) at oracle.adf.model.BindingRequestHandler.invokeBeginRequest(BindingRequestHandler.java:349) at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:166) at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:161) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:313) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:199) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)## Detail 0 ##oracle.jbo.InvalidObjNameException: JBO-25005: Object name 1 for type Variable is invalid at oracle.jbo.common.VariableImpl.validateName(VariableImpl.java:234) at oracle.jbo.common.VariableImpl.setVariableKind(VariableImpl.java:301) at oracle.jbo.server.ViewObjectImpl.activateParams(ViewObjectImpl.java:13417) at oracle.jbo.server.ViewObjectImpl.doActivateSettings(ViewObjectImpl.java:13479) at oracle.jbo.server.ViewObjectImpl.doActivateSettings(ViewObjectImpl.java:13328) at oracle.jbo.server.ApplicationModuleImpl.activateVOs(ApplicationModuleImpl.java:7181) at oracle.jbo.server.ApplicationModuleImpl.doActivateState(ApplicationModuleImpl.java:6981) at oracle.jbo.server.ApplicationModuleImpl.doActivateAMState(ApplicationModuleImpl.java:6960) at oracle.jbo.server.Serializer.activate(Serializer.java:274) at oracle.jbo.server.DBSerializer.activateRootAM(DBSerializer.java:330) at oracle.jbo.server.ApplicationModuleImpl.activateState(ApplicationModuleImpl.java:5549) at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:178) at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:7777) at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4074) at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2161) at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1961) at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1998) at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:2793) at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:453) at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:233) at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:424) at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:419) at oracle.adf.model.bc4j.DCJboDataControl.rebuildApplicationModule(DCJboDataControl.java:1517) at oracle.adf.model.bc4j.DCJboDataControl.beginRequest(DCJboDataControl.java:1381) at oracle.adf.model.BindingContext.beginRequest(BindingContext.java:683) at oracle.adf.model.BindingRequestHandler.invokeBeginRequest(BindingRequestHandler.java:349) at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:166) at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:161) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:313) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:199) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)
please help, i am stuck for days.
Thank you"Let me understand more about this.
Does this happen always only with one user or username?
Does this happen only when he/she accesses a particular page?"
it happens only with one user when she/he accesses a particular page -
Help in using record type and object type
Hi Experts,
I am new to object types and record types.
I want to return the output of this query using one OUT parameter
from the procedure using RECORD type or OBJECT type.
with out using refcursor.
SELECT empno,ename,sal FROM emp WHERE deptno=30;
Let us assume the query is returning 50 records.
I want to send those 50 records to OUT parameter using record type or object type.
Please provide the for the requirement code using RECORD TYPE and OBJECT TYPE separately.
Your earliest response is appreciated.
Thanks in advance.Hi All,
I have tried this.But it ising not work
CREATE OR REPLACE PACKAGE maultiplevalues_pkg
IS
TYPE t_record IS RECORD
(empno emp.empno%TYPE,
ename emp.ename%TYPE,
sal emp.sal%TYPE);
V_RECORD t_record;
TYPE t_type IS TABLE OF V_RECORD%TYPE;
PROCEDURE maultiplevalues_pROC(p_deptno IN emp.deptno%TYPE,
dept_result OUT t_type);
END;
CREATE OR REPLACE PACKAGE body maultiplevalues_pkg
IS
PROCEDURE maultiplevalues_pROC(p_deptno IN emp.deptno%TYPE,
dept_result OUT t_type)
is
begin
dept_result :=t_type();
for I in(
select EMPNO,ENAME,SAL from EMP WHERE deptno=p_deptno
LOOP
dept_result.extend;
dept_result(i).empno :=i.empno;
dept_result(i).ename :=i.ename;
dept_result(i).sal :=i.sal;
END LOOP;
END;
END;
Please help me OUT return multiple values through single OUT variable in a procedure.
Thanks. -
Need help on object type(complex)
Hi All,
i have an object type account_t as
create type account_t as object (accountnumber number(30),
holdername varchar2(20),
currentamount number(20),
minimalamount number(20),
status varchar2(10),
member procedure setcurrentamount(v_amount number),
member function getcurrentamount return number,
member procedure setstatus(v_status boolean),
member function getstatus return varchar2,
member procedure setholdername(v_holdername varchar2),
member function getholdername return varchar2);
i create another type accountmanager_t as
create type accountmanager_t as object (
depositamount number(30),
withdrawalamount number(30),
v_accountt account_t,
member function deposit(d_accountt account_t,d_transno number default 1) return account_t,
member function withdraw(w_accountt account_t,w_transno number default 2) return account_t);
Accountmanager_t body as :
create or replace type body accountmanager_t as
member function deposit(d_accountt account_t,d_transno number default 1) return account_t as
begin
return self.amount+self.depositamount;
end deposit;
member function withdraw(w_accountt account_t,w_transno number default 2) return account_t as
begin
if self.status='OPEN' then
if (currentamount-self.withdrawalamount) < minimalamount then
if (currentamount-self.withdrawalamount) <> 0 then
status:='CLOSED';
return self.currentamount-self.withdrawalamount;
end if;
end if;
myprint('No Sufficient funds for Withdrawal');
return self.currentamount;
end if;
myprint('No withdrawal for closed account');
return self.currentamount;
end withdraw;
end;
i get the errors as :
4/3 PL/SQL: Statement ignored
4/15 PLS-00302: component 'AMOUNT' must be declared
8/3 PL/SQL: Statement ignored
8/11 PLS-00302: component 'STATUS' must be declared
19/3 PL/SQL: Statement ignored
19/15 PLS-00302: component 'CURRENTAMOUNT' must be declared
SQL>
How to pass the values of these variables from account_t type to accountmanager_t type?
Any help??
Regards,
s.return self.amount+self.depositamount;I counld not find any amount field in your type definitions
if self.status='OPEN' thenIs it w_accountt.status ?? since there is no status field in accountmanager_t type
return self.currentamount-self.withdrawalamount;same comments for currentamount
member function deposit(d_accountt account_t,d_transno number default 1) return account_t asWhere as your return expression is a number?? -
Require help on Array of Nested tables and Oracle Object type
Hi All,
I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
Tablename: FILE_RECORD
Rows:
FILE_REG_ID = 1
RECORD_NBR = 1
PROCESSED_IND = U
RECORD= 00120130326006A
FILE_REG_ID = 1
RECORD_NBR = 2
PROCESSED_IND = U
RECORD= 00120130326003
1) I have to read these records at once and
a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
b) send as an Array to Java.
2) Java will format this into XML and sent to other application.
3) The other application returns a response as Successful or Failure to Java in XML
4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
Eg: For RECORD_NBR
SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
Eg: T_FILE_RECORD_REC IS OBJECT
FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
Thanks in advance,I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
Are you processing the records one at a time? -
JBO-25005: Object name 1 for type Variable is invalid
Facing the error as below when clicking on messagedownload field on an OAF search page.
below are the properties set
ID : Attachment
Item Style : messageDownload
file MiIME type : text/HTML
Data Type : BLOB
ViewInstance : SerchReqVO1
ViewAttribute : FileName
File ViewAttribute : Filedata
Please let me know if any other properties are to be changed to prevent this error.
Error Page
Exception Details.
oracle.apps.fnd.framework.OAException: oracle.jbo.InvalidObjNameException: JBO-25005: Object name 1 for type Variable is invalid
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
at OA.jspService(_OA.java:71)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)Hi,
If the primary key of the table is checked as Key attribute by clicking Edit VO->Attributes->Primary key field
this issue can be prevented. -
Need some help on procedure calling procedure using object type reg
dear all,
i need to test one procedure by passing only one value but how do i pass single value. i am showing the details of few section on which i am working on. here is few details about the package.
Description: package pkj_emp contains two procedure pkj_emp and procedure proc_rem.
purpose:based on passing dname values to procedure pkj_emp, cursor cur_emp will fetch empid from emp table and then we are passing 4 empid records to procedure proc_rem using empid object type.Inside the procedure proc_rem it will delete all 4 records of table A,B,C and D at one short.
Requirement:i need to test for only one value that means is it possible i can pass only one value using the cursor cur_emp.
create or replace package pkj_emp
TYPE obj_emp IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
procedure proc_emp(empid obj_emp);
create or replace package body pkj_emp
as
procedure(
dname varchar2;
as
cursor cur_emp is select emp_id from emp a,dept d
where a.deptid=d.deptid
and d.deptname=dname;
begin
count:=0;
for cur_emp_rec in cur_emp LOOP
empid(count) := cur_emp_rec.emp_id;
IF (count = 4) THEN
proc_rem(empid); // calling another procedure
commit;
END IF;
count := count + 1;
END LOOP;
end;
proc_rem(
empid obj_emp;
is
begin
delete from A where emp_id in (empid(0),empid(1),empid(2),empid(3));
delete from B where emp_id in (empid(0),empid(1),empid(2),empid(3));
delete from c where emp_id in (empid(0),empid(1),empid(2),empid(3));
delete from d where emp_id in (empid(0),empid(1),empid(2),empid(3));
end;
regards
LaxmanYou have hardcoded your IN LIST in the REM procedure. I recommend changing the code to take a variable number of inputs. You could do something like the following:
SQL> CREATE TABLE A (ID NUMBER);
Table created.
SQL> CREATE TABLE B (ID NUMBER);
Table created.
SQL> CREATE TABLE C (ID NUMBER);
Table created.
SQL> CREATE TABLE D (ID NUMBER);
Table created.
SQL> INSERT INTO A VALUES(7566);
1 row created.
SQL> INSERT INTO B VALUES(7902);
1 row created.
SQL> INSERT INTO C VALUES(7876);
1 row created.
SQL> INSERT INTO D VALUES(7369);
1 row created.
SQL> CREATE OR REPLACE TYPE EMP_TYPE AS TABLE OF NUMBER(4);
2 /
Type created.
SQL> CREATE OR REPLACE PACKAGE PKJ_EMP
2 AS
3 PROCEDURE PKJ_EMP
4 (
5 DNAME IN SCOTT.EMP.DEPTNO%TYPE
6 );
7
8 PROCEDURE REM
9 (
10 pEMPList IN EMP_TYPE
11 );
12 END PKJ_EMP;
13 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY PKJ_EMP
2 AS
3 PROCEDURE PKJ_EMP
4 (
5 DNAME IN SCOTT.EMP.DEPTNO%TYPE
6 )
7 AS
8 pEMPList EMP_TYPE := EMP_TYPE();
9 i NUMBER := 1;
10 BEGIN
11 FOR r IN
12 (
13 SELECT EMPNO
14 FROM SCOTT.EMP
15 WHERE DEPTNO = DNAME
16 )
17 LOOP
18 pEMPList.EXTEND;
19 pEMPList(i) := r.EMPNO;
20
21 i := i + 1;
22 END LOOP;
23
24 REM(pEMPList);
25 END PKJ_EMP;
26
27 PROCEDURE REM
28 (
29 pEMPList IN EMP_TYPE
30 )
31 AS
32 BEGIN
33 DELETE FROM A WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(pEMPList));
34 DELETE FROM B WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(pEMPList));
35 DELETE FROM C WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(pEMPList));
36 DELETE FROM D WHERE ID IN (SELECT COLUMN_VALUE FROM TABLE(pEMPList));
37 END REM;
38 END PKJ_EMP;
39 /
Package body created.
SQL> EXEC PKJ_EMP.PKJ_EMP(20);
PL/SQL procedure successfully completed.
SQL> SELECT * FROM A;
no rows selected
SQL> SELECT * FROM B;
no rows selected
SQL> SELECT * FROM C;
no rows selected
SQL> SELECT * FROM D;
no rows selected
SQL> spool off;HTH! -
BI Content Input Help Not Working on Object Type View
In the BI Content area, if I go to the Object Type View and click on 'Select Objects' for Datasources or InfoPackages, I will not get the Input Help screen.
I am running SAP BI 7.0 Level 0013. BI Content is version 7.03 Level 0005
I am sure there is a note to fix this, but I have not been able to find it!
ThanksAll of the correct Source Systems Assignments were not selected.
-
[solved] JBO-25005: Object name 1 for type Variable is invalid
Hi All
When Deploying our Application to Oracle Application server we got this Exception on the Application log after while
JBO-30003: The application pool (model.setup.SetupAppModuleLocal) failed to checkout an application module due to the following exception:
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.InvalidObjNameException, msg=JBO-25005: Object name 1 for type Variable is invalid
at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2002)
at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:2793)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:453)
at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:233)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:424)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:419)
at oracle.adf.model.bc4j.DCJboDataControl.rebuildApplicationModule(DCJboDataControl.java:1543)
at oracle.adf.model.bc4j.DCJboDataControl.beginRequest(DCJboDataControl.java:1404)
at oracle.adf.model.BindingContext.beginRequest(BindingContext.java:683)
at oracle.adf.model.BindingRequestHandler.invokeBeginRequest(BindingRequestHandler.java:346)
at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:166)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:161)
## Detail 0 ##
oracle.jbo.InvalidObjNameException: JBO-25005: Object name 1 for type Variable is invalid
at oracle.jbo.common.VariableImpl.validateName(VariableImpl.java:234)
at oracle.jbo.common.VariableImpl.setVariableKind(VariableImpl.java:301)
at oracle.jbo.server.ViewObjectImpl.activateParams(ViewObjectImpl.java:13306)
at oracle.jbo.server.ViewObjectImpl.doActivateSettings(ViewObjectImpl.java:13368)
at oracle.jbo.server.ViewObjectImpl.doActivateSettings(ViewObjectImpl.java:13217)
at oracle.jbo.server.ApplicationModuleImpl.activateVOs(ApplicationModuleImpl.java:7173)
at oracle.jbo.server.ApplicationModuleImpl.doActivateState(ApplicationModuleImpl.java:6996)
at oracle.jbo.server.ApplicationModuleImpl.doActivateAMState(ApplicationModuleImpl.java:6961)
What does this mean ??Hi Mahmoud,
from the stack trace, it appears the error occurs at AM activation.
Check your application is activation-safe by setting the parameter jbo.ampool.doampooling=false in your development environment.
See "Set jbo.ampool.doampooling=false to Reproduce Problems Related to AM Passivation / Activation"
URL: http://blogs.oracle.com/Didier/2006/11/12
Does the error reproduces there ?
You will then be able to diagnose the issue further, f.ex. by switching on the BC4J diagnostics, with the java option -Djbo.debugoutput=console:
in your Project properties , in the Run/Debug panel, select a run configuration and click Edit to edit it.
Then add the string -Djbo.debugoutput=console to the Java Options field.
Then run your application and reproduce the error.
You'll then probably know the VO that has the problem.
At activation, ADF BC has to reset the bind variables, and it seems there is a problem at that time.
What kind of bind variables do you use ?
Positional bind variables or named bind variables ?
Regards,
Didier. -
Persisting Instance Variables in Object Types across PL/SQL Calls
How can I persist instance variables in my java class/object across PL/SQL calls via a PL/SQL object type.
What I am finding is that if I do not have an attribute defined in my PL/SQL datatype that the value is not persisted between calls on the object in the PL/SQL environment. I am using the SQLData interface.
Should I create a static variable that uses the singleton pattern?
Any insights appreciated.How can I persist instance variables in my java class/object across PL/SQL calls via a PL/SQL object type.
What I am finding is that if I do not have an attribute defined in my PL/SQL datatype that the value is not persisted between calls on the object in the PL/SQL environment. I am using the SQLData interface.
Should I create a static variable that uses the singleton pattern?
Any insights appreciated.
Maybe you are looking for
-
Freezing when trying to print out PDF?
Trying to print out PDF of Aperture 'book'. Each time it freezes on the same page ... this particular page is where I have one image stretched across two pages. Is this possibly a glitch with Aperture? Ben I've trashed my preferences several times; d
-
CS6 - add non-editable region inside editable template region?
I have the following in a template: <div class="main-content"> <!-- TemplateBeginEditable name="main-content" --> <div class="content p7ehc-1"> <!-- from projectseven.com; don't change --> <h1 class="page-topper">Enter topic here</h
-
Hi Gurus, We have issue with our configurator. We recently upgraded to 12.1.3 from 12.0.6 and from then on we see below issue. As soon as we enter a model and try to configure we get below error and more details of the exceptions are attached to the
-
4500X and IOS XE 03.05.01 Fa1 issues
Hi I recently got two 4500X boxes I'm trying to get going in the lab. It seems that getting management working is biggest challenge. The preinstalled IOS XE was cat4500e-universalk9.SPA.03.04.02.SG.151-2.SG2.bin witch works great. No issues so far. I
-
Hi Experts, Can any one please brief me about the possible systems in receiver side when the sender is SAP and receiver is using RNIF adapter. i mean that if the RNIF adapter is used at the receiver side then, what will be the possible receiver syste