Accessing ALL_TAB_COLUMNS from a Procedure
Hi,
I want a help in Accessing ALL_TAB_COLUMNS from a procedure.
I am an getting Error as Insufficient Privileges while Executing the Procedure.
Any help will be Benefitial
Thanks and Regards
You should not really be using SYS.
Is this a general issue with accessing "ALL_" views (i.e. information about other schemas than your own) within procedures? If so perhaps the account needs SELECT ANY DICTIONARY system privilege. although as with any system privilege you should consider the security implications.
If it's specifically ALL_TAB_COLUMNS and not the rest of the dictionary views, then a grant on that view to the owner of the package will do it.
Similar Messages
-
Accessing Data from Stored Procedure using CallableStatement
I have created a Stored Procedure as shown , IS it possible to access these data inside my JDBC Program ??
CREATE or replace PROCEDURE getEmpName(EMP_NUM IN NUMBER)
is
CURSOR C1 is select from emp ;*
C2 c1%rowtype;
BEGIN
open c1;
loop
fetch c1 into c2;
exit when c1%NOTFOuND;
end loop;
END ;
*CallableStatement cs = conn.prepareCall("{call getEmpName(?)}");*What do you mean by :
IS it possible to access these data inside my JDBC Program ??JDBC provide/helps to execute a stored proc. when we say executing a proc, it actually executes on DB. So if a proc is written which has in and out parameter. and if does some work based on in parameter and returns the result in out parameter. Here if you mean, like can i read the out parameter and check what it has returned, then yes you can access this data from JDBC.
CREATE or replace PROCEDURE getEmpName(EMP_NUM IN NUMBER)
is
CURSOR C1 is select from emp ;*
C2 c1%rowtype;
BEGIN
open c1;
loop
fetch c1 into c2;
exit when c1%NOTFOuND;
end loop;
END ;
/But in your above proc it has only in parameter, no out parameter and has only select. so you could execute the proc using JDBC. -
Can I create a Stored Procedure That access data from tables of another servers?
I'm developing a procedure and within it I'm trying to access another server and make a select into a table that belongs to this another server. When I compile this procedure I have this error message: " PLS-00904: insufficient privilege to access object BC.CADPAP", where BC.CADPAP is the problematic table.
How can I use more than one connection into an Oracle Stored Procedure?
How I can access tables of a server from a Stored Procedure since the moment I'm already connected with another server?
Can I create a Stored Procedure That access data from tables of another servers?You need to have a Database Link between two servers. Then you could do execute that statement without any problem. Try to create a database link with the help of
CREATE DATABASE LINK command. Refer Document for further details -
Accessing tables from different schema in CDS and AMDP
Hi All,
We are working on a HANA system which has several schema replicated from SAP R/3/Non SAP systems. We have BW 7.4 SP9 deployed on the same system and accessing the HANA views using latest BW virtual objects such as Open ODS , Composite providers etc.
We are also using the BW system for few ABAP based data processing developments. We are currently accessing HANA views in ABAP programs by creating dictionary views based on external HANA views.
We would like to however use recent possibilities of CDS and AMDP for better life cycle management of ABAP based solutions. The open SAP course on this subject was of very good help. Thanks a lot "open SAP team" for that. I would however have few open questions,
As I understand AMDP gives us full flexibility of writing sql procedures within ABAP development environment, but can we access tables from different schema into AMDP code. If yes, then sample code would help.
If the answer of first question is yes, then how do we manage transports between development and production systems where the schema names would be different. Currently in open HANA developments, such transport is manged using Schema mapping.
Can I also use different schema tables in CDS views.
We are updating few tables in ABAP dictionary after applying processing logic in ABAP program as detailed in step 1. With the new approach using AMDP, can we directly update database schema tables which will give us an optimization advantage.
New ABAP HANA program interfaces are quite promising and we would like to use them to optimize many data intensive applications.
Thanks & Regards,
AnilHi Anil,
I can only answer 1. and 2. (and would be interested into 3. as well):
1.
Yes you can access tables from a different schema and also HANA views. In this case no 'using' is needed.
Examples:
RESULT = SELECT
FROM
"SAP_ECC"."T441V" AS t,
"_SYS_BIC"."tmp.package/AFPO" AS a.
WHERE ...
2. In this case, if you need schema mapping: You could use HANA (projection) views which just forward to a different schema, also see example.
Best regards,
Christoph -
How to get a recordset in vb to access a oracle store procedure.
I have a store procedure(sproc) that needs to be called from a VB Application. I was being told that I would have to create a PL/SQL table in my store procedure for the VB Developer to access information from my store procedure. This is beacasue he wants it as a record set. Is that the way to get info for a VB front end. My sproc is a very basic one
My sproc looks like
create or replace PROCEDURE SP_TBLINFO
(ID out TBLINFO.id%type,
ACCOUNT_NUMBER out TBLINFO.account_number%type)
AS
CURSOR TBLINFO_CURSOR IS
SELECT * FROM TBLINFO;
V_TBLINFO_CURSOR TBLINFO_CURSOR%ROWTYPE;
BEGIN
OPEN TBLINFO_CURSOR ;
Loop
FETCH TBLINFO_CURSOR INTO V_TBLINFO_CURSOR;
EXIT WHEN TBLINFO_CURSOR %NOTFOUND;
ID := V_TBLINFO_CURSOR.id;
ACCOUNT_NUMBER:= V_TBLINFO_CURSOR.account_number;
END LOOP;
CLOSE TBLINFO_CURSOR ;
END SP_TBLINFO;
Thanks.Use a REF_CURSOR, something like the following:
create or replace package SP_TBLINFO as
CURSOR TBLINFO_CURSOR IS SELECT * FROM TBLINFO;
create type TBLINFO_CURSOR_TYPE is TBLINFO_CURSOR%ROWTYPE;
procedure PROC_TBLINFO(Info out TBLINFO_CURSOR_TYPE);
end;
create or replace package body SP_TBLINFO as
PROCEDURE PROC_TBLINFO
(Info out TBLINFO_CURSOR_TYPE)
AS
BEGIN
OPEN ACCOUNT_NUMBER as SELECT * FROM TBLINFO ;
END SP_TBLINFO;
END;
Then bind it in OO4O as ORATYPE_CURSOR. -
EJB from stored procedure lookup problem
We are running a test case with in an EJB deployed to Oracle 8.1.6, accessing it from a Java stored procedure. It works okay if the stored procedure is called a limited number of times from a single client (client is non-Java). However, for performance testing, we are trying to run it several hundred times in sequence to better simulate the eventual production environment. Consistently on the 216th call, it fails with a NamingException from the InitialContext lookup. We can restart the client again and it will fail on the same call.
Sounds like something memory related to me. Does anyone have any ideas? I'm using standard EJB client code in my stored procedure, instantiating an InitialContext, performing a lookup on the EJB, performing a home interface create, then accessing an EJB method.
Thinking it might be that my test was too fast for whatever garbage collection is being done on the server, I tried a 2 second delay between invocations--same problem occurs, however. Should I be making a call to remove my EJBs when my stored procedure ends? If so, how would I do that?
I did try making the handle to my EJB a static variable within the stored procedure and only "creating" the EJB once. That works okay with a single client, but if I run 2 clients simultaneously, 1 will work for awhile and then eventually die trying to call the EJB method--while the other client continues to run successfully.
I'm stumped. Any insight or guidance will be greatly appreciated. Thanks.My DBA bumped up the large_pool_size and java_pool_size settings and the problem went away. I couldn't convince him to bump the settings one at a time, so am not sure which one was at the root of the problem.
As I looked at the trace logs on the server, I also noticed that we were getting intermittent "peer disconnected socket" messages during the testing. That appears to have gone away with the pool size increases, also--in case that helps out anyone else. -
Problem with execute SSIS package from stored procedure
Hi,
I would like to execute SSIS package from stored procedure. Therefore, I implemented sp which exec SSISDB.CATALOG.CREATE_EXECUTION method. When I try to test it from SSMS on remote server, I got error that
I was able to solve by adding “WITH EXECUTE AS …”. Then I got another error: The server principal "Domain\user" is not able to access the database "SSISDB" under the current security context. On Internet, I found a couple post that describe
how to access SSIS catalog (one of them by Ke Yang -
http://blogs.msdn.com/b/mattm/archive/2012/03/20/ssis-catalog-access-control-tips.aspx). It didn’t help. I’m still getting the error message.
How to debug this issue?
Any suggestion?
Thanks
SQL Server 2014 BISSMS does not propagate user credentials thus the error
Arthur
MyBlog
Twitter -
Accessing DBA_TABLES from PL/SQL
Hi all,
Can I access DBA_TABLES from a PL/SQL block?
Following is the code I tried:
SQL> SHOW USER
USER is "SYSTEM"
SQL> ED
Wrote file afiedt.buf
1 CREATE OR REPLACE PACKAGE BODY BARAKAU
2 AS
3 PROCEDURE UPPER_COLS ( P_USER VARCHAR2, P_TABLE VARCHAR2 ) IS
4 BEGIN
5 -- loop through tables
6 FOR T IN ( SELECT TABLE_NAME FROM DBA_TABLES WHERE TABLE_NAME = NVL(P_TABLE, TABLE_NAME)
7 AND OWNER=UPPER(P_USER) ORDER BY TABLE_NAME) LOOP
8 DBMS_OUTPUT.PUT_LINE(T.TABLE_NAME || ' processed');
9 END LOOP;
10 END UPPER_COLS;
11* END BARAKAU;
SQL> /
Warning: Package Body created with compilation errors.
SQL> SHOW ERROR
Errors for PACKAGE BODY BARAKAU:
LINE/COL ERROR
6/13 PL/SQL: SQL Statement ignored
6/36 PL/SQL: ORA-00942: table or view does not exist
8/4 PL/SQL: Statement ignored
8/25 PLS-00364: loop index variable 'T' use is invalid
SQL> L 6
6* FOR T IN ( SELECT TABLE_NAME FROM DBA_TABLES WHERE TABLE_NAME = NVL(P_TABLE, TABLE_NAME)Oracle 11g on WindowsHi,
SQL> SHOW USER
User is "SYS"
SQL>
Package created
Package body created
No errors for PACKAGE BODY SYS.BARAKAUPackage creation:
CREATE OR REPLACE PACKAGE BARAKAU AS
PROCEDURE UPPER_COLS(P_USER VARCHAR2,
P_TABLE VARCHAR2);
END BARAKAU;
CREATE OR REPLACE PACKAGE BODY BARAKAU AS
PROCEDURE UPPER_COLS(P_USER VARCHAR2,
P_TABLE VARCHAR2) IS
BEGIN
-- loop through tables
FOR T IN (SELECT TABLE_NAME
FROM DBA_ALL_TABLES
WHERE TABLE_NAME = NVL(P_TABLE, TABLE_NAME)
AND OWNER = UPPER(P_USER)
ORDER BY TABLE_NAME)
LOOP
DBMS_OUTPUT.PUT_LINE(T.TABLE_NAME || ' processed');
END LOOP;
END UPPER_COLS;
END BARAKAU;
SHOW ERRORSNote: It's not a good idea create specific packages or other objects with users like sys or system...
Regards, -
Update Yes/No field in access table through oracle procedure
Hi,
How to update Yes/No field in access table through oracle procedure. all other fields like AutoNumber, Text I can update it. Yes/No field how to update? Please, any one can help me?
Thanks and Regards,
Sudha.Sudha Teki wrote:
select "fldPost" from tblPHd@ODBCLNKNot quite sure what you mean, but the way you select the column would indicate a case sensitive column name
Look at this example
SQL> create table t
2 ("this" varchar2(10))
3 /
Table created.
SQL> insert into t values ('hello')
2 /
1 row created.
SQL> select *
2 from t
3 /
this
hello
SQL> select this
2 from t
3 /
select this
ERROR at line 1:
ORA-00904: "THIS": invalid identifier
SQL> select "this"
2 from t
3 /
this
helloIs your column name also case sensitive? -
Accessing DBMS_AQ from Apex screen gives an error
Hi,
I have created an Advanced queue (DBMS_AQ) in my schema and i can successfully enqueue and dequeue messages through a stored proc.
But when i call the same stored proc from an APEX screen, i get the following error.
"ORA-24010: QUEUE APEX_PUBLIC_USER.<Q_name> does not exist."
As AQ admin and even as SYSDBA, the following permissions were given, but still
no luck.
1) DBMS_AQADM.grant_queue_privilege (
privilege => 'ENQUEUE_ANY',
queue_name => 'Q_name',
grantee => 'APEX_PUBLIC_USER',
grant_option => FALSE);
2) DBMS_AQADM.grant_queue_privilege (
privilege => 'DEQUEUE_ANY',
queue_name => 'Q_name',
grantee => 'APEX_PUBLIC_USER',
grant_option => FALSE);
3) DBMS_AQADM.grant_queue_privilege (
privilege => 'ALL',
queue_name => 'Q_name',
grantee => 'PUBLIC',
grant_option => FALSE);
4) Created a public synonym for the queue and tried to access the queue from the screen.
Can you please help me to access the Queue from APEX screens ?Hi Scott,
First to answer your questions based on the error i was getting
All 1 , 2 and 3 are the same.
1) The schema assigned to the application is 'XYZ'
2) 'XYZ' is the AQ_administrator
3) Permission was granted to APEX_PUBLIC_USER by connecting as 'XYZ'.
Also in my local XE DB, i tried the same and i am able to access Q from the APEX application created in that Schema.
I did not grant any privilege except that the schema (foo) is the AQ_ADMIN.
schema: foo
workspace: foo (automatically created when i create an app in the schema)
parsing schema: foo
Please find the steps below
Connect As Sysdba
AQ_ADMIN PRIVELEGES
1) GRANT aq_administrator_role TO foo;
2) GRANT execute ON dbms_aq TO foo;
3) GRANT execute ON dbms_aqadm TO foo;
Connect As foo
1) create type image_uploaded_ot as object
sheet_id NUMBER(15));
2) GRANT EXECUTE ON IMAGE_UPLOADED_OT TO PUBLIC;
-- create QT and Q
3) begin
DBMS_AQADM.CREATE_QUEUE_TABLE (
queue_table => 'image_uploaded_qt',
queue_payload_type => 'image_uploaded_ot'
DBMS_AQADM.CREATE_QUEUE (
queue_name => 'image_uploaded_q',
queue_table => 'image_uploaded_qt'
DBMS_AQADM.START_QUEUE (
queue_name => 'image_uploaded_q'
end;
-- verify if queue exists
4) SELECT name, enqueue_enabled, dequeue_enabled
FROM user_queues;
SELECT name, enqueue_enabled, dequeue_enabled
FROM user_queues;
5) TESTING - ENQUEUE/DEQUEUE
CREATE OR REPLACE PROCEDURE demo_enqueue ( OT_I image_uploaded_ot)
IS
enq_msgid RAW(16);
eopt dbms_aq.enqueue_options_t;
mprop dbms_aq.message_properties_t;
aprop sys.aq$_agent;
pragma autonomous_transaction;
BEGIN
aprop := sys.aq$_agent(NULL, 'foo.image_uploaded_q', 0);
mprop.sender_id := aprop;
dbms_aq.enqueue('foo.image_uploaded_q', eopt, mprop, OT_I, enq_msgid);
COMMIT;
END demo_enqueue;
CREATE OR REPLACE PROCEDURE demo_dequeue IS
deq_msgid RAW(16);
dopt dbms_aq.dequeue_options_t;
mprop dbms_aq.message_properties_t;
payload_t image_uploaded_ot;
q_on_hand PLS_INTEGER;
no_messages EXCEPTION;
pragma exception_init(no_messages, -25228);
pragma autonomous_transaction;
BEGIN
dopt.dequeue_mode := dbms_aq.remove;
dopt.navigation := dbms_aq.first_message;
dopt.visibility := dbms_aq.immediate;
-- add functionality with mprop.attempts and mprop.enqueue_time
dbms_aq.dequeue('foo.image_uploaded_q', dopt, mprop, payload_t, deq_msgid);
UPDATE OFFICE
SET OFFICE_NAME = 'TEST'
WHERE OFFICE_ID = payload_t.SHEET_ID;
COMMIT;
EXCEPTION
WHEN others THEN
RAISE;
END;
6) TESTING FROM APEX
created a pl/sql process
declare
test_ot image_uploaded_ot;
begin
test_ot := image_uploaded_ot(1);
demo_enqueue(test_ot);
demo_dequeue();
end;
By looking at the test program above and the answer to the questions. The test prgm satisfies criteria 1 and 2 above and as you had mentioned and confirmed by test prgm, 3 is not required.
I am not sure what privilege is missing in the actual schema.
But atleast a hope that a AQ is accessible from APEX :)
Thanks,
Rakesh -
Is there a way to access object from other schema?
1. Is there a way to access object from other schema
Without using synonym/public synonym without prefixing schema owner?
2. If you do not see any object in all_objects by same name owned by connected user or public, can there still be objects hidden from this view? for instance synonyms created by SYSTEM
TIA for helpWell, you missed something somewhere. If there is no
ALTER SESSION SET CURRENT_SCHEMA=whoeverthen there must be either public synonym for the object as this shows:
SQL> CREATE USER a identified by a;
User created.
SQL> GRANT CREATE SESSION to a;
Grant succeeded.
SQL> CREATE USER b identified by b;
User created.
SQL> GRANT CREATE SESSION, CREATE PROCEDURE, CREATE PUBLIC SYNONYM to b;
Grant succeeded.
SQL> connect b/b
Connected.
SQL> CREATE PACKAGE test AS
2 PROCEDURE testit;
3 END;
4 /
Package created.
SQL> CREATE PACKAGE BODY test AS
2 PROCEDURE testit IS
3 BEGIN
4 NULL;
5 END;
6 END;
7 /
Package body created.
SQL> connect a/a
Connected.
SQL> desc b.test
ERROR:
ORA-04043: object b.test does not exist
SQL> connect b/b
Connected.
SQL> GRANT EXECUTE ON test TO a;
Grant succeeded.
SQL> connect a/a
Connected.
SQL> desc b.test;
PROCEDURE TESTIT
SQL> desc test;
ERROR:
ORA-04043: object test does not exist
SQL> connect b/b
Connected.
SQL> CREATE PUBLIC SYNONYM test FOR TEST;
Synonym created.
SQL> connect a/a
Connected.
SQL> desc test
PROCEDURE TESTITAnother possibility without public synonyms is that crv had granted the other user privileges on some object, and the other user creates a private synonym for that. When crv granted privileges on a different object with the same name, the private synonym became valid again. Something like:
SQL> connect /
Connected.
SQL> drop public synonym test;
Synonym dropped.
SQL> GRANT CREATE SYNONYM TO a;
Grant succeeded.
SQL> connect a/a
Connected.
SQL> desc test;
ERROR:
ORA-04043: object test does not exist
SQL> desc b.test
PROCEDURE TESTIT
SQL> CREATE SYNONYM test FOR b.test;
Synonym created.
SQL> desc test;
PROCEDURE TESTIT
SQL> connect b/b
Connected.
SQL> REVOKE EXECUTE ON test FROM a;
Revoke succeeded.
SQL> connect a/a
Connected.
SQL> desc test;
ERROR:
ORA-04043: object "B"."TEST" does not exist
SQL> desc b.test
ERROR:
ORA-04043: object b.test does not exist
SQL> connect b/b
Connected.
SQL> DROP PACKAGE test;
Package dropped.
SQL> CREATE FUNCTION test (p_num IN NUMBER) RETURN NUMBER AS
2 BEGIN
3 RETURN p_num * 10;
4 END;
5 /
Function created.
SQL> GRANT EXECUTE ON test TO a;
Grant succeeded.
SQL> connect a/a
Connected.
SQL> desc test;
FUNCTION test RETURNS NUMBER
Argument Name Type In/Out Default?
P_NUM NUMBER INSo, I would go looking for the synonyms.
TTFN
John -
URGENT : Return Bulk data from Stored Procedure
Hi,
Tell me, how do I return a bulk of data which
does not exist in the data base
but is concluded while the Stored Procedure is executed
from the Stored procedure
to the C++ program.
For Example:
Table ABC
Field1 Field2 Field3
A 1 3
B 1 5
C 2 10
Table DEF
Field1 Field2 Field3
D 10 24
E 3 16
F 8 19
SP_TESTING
Depending on the values in both the tables
for some range of conditions,
a conclusion X is derived for each range value of the
condition range.
Now I need to return this bulk of data X with the
condition they belong to
back to the C++ code calling it....
NOTE : A stored procedure is requited as there is a lot
of processing
required before we conclude the result X for each value
in the condition range.
If I execute this code from C++ instead of Stored
procedure
it is very slow and speed is a prime requirement of my
system.
Also i'm not using any MFC class to access database.
I'm using ConnectionPtr, RecordsetPtr and _CommandPtr
from msado15.dll for database access...
One solution to this could be use of Temp tables.
As this process is used by a lot of different stored
procedures having a common
temp table to all will need something like 50 NUMERIC
fields, 50 VARCHAR fields
and so on, which doesn't seem like a very good solution
to this problem.
Sounds like something I would have done while in school,
implement a dumb solution.
So, please suggest me a solution as to how do I return
bulk data in the form
of recordsets from stored procedure.
Regards
ShrutiUse Out parameter mode
SQL> CREATE OR REPLACE procedure a1 (x OUT NUMBER, y OUT NUMBER) AS
2 BEGIN
3 x:= 1;
4 y:= 2;
5 END;
6 .
SQL> /
Procedure created.
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 a NUMBER :=3;
3 b NUMBER :=4;
4 BEGIN
5 a1 (a,b);
6 DBMS_OUTPUT.PUT_LINE( 'a = ' || a );
7 dbms_output.put_line( 'b = ' || b );
8 END;
9 .
SQL> /
a = 1
b = 2
PL/SQL procedure successfully completed.By default parameters are copied to the OUT parameter mode .
COPY hint in PLSQL don’t send a pointer to calling program unit but NOCOPY
does.
Khurram -
SP which returns error cannot access rows from a non-nested table item.
Dear Experts
I have an SP which gives error " cannot access rows from a non-nested table item ". But here the strange thing is, it works fine with one query. But I write union query with another table, only then it gives error.
CREATE OR REPLACE PROCEDURE SP_MONTHLYSALESUMMARY (
P_TRANSACTIONMONTH VARCHAR2,
P_LEDGERID VARCHAR2,
O_RESULTSET OUT TYPES.CURSORTYPE)
AS
BEGIN
OPEN O_RESULTSET FOR
-- POINT OF SALE
SELECT
L.DESCRIPTION LEDGERNAME,
LS.DESCRIPTION LEDGERSUBGROUPNAME,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO
AS ID,
C.NAME || E.NAME || AF.NAME || M.NAME AS NAME,
SUM(CASE
WHEN PB.EMPLOYEE_ID IS NOT NULL
AND T.ISCREDITTRANSACTIONMODE = 2
THEN
PB.TAXAMOUNT
ELSE
0
END)
EMPLOYEEDEBITCARDTAXAMOUNT,
L.PRINTNO
FROM POINTOFSALEBILL PB
INNER JOIN POINTOFSALEBILLDETAIL PD
ON PB.POINTOFSALEBILL_ID = PD.POINTOFSALEBILL_ID
INNER JOIN TRANSACTIONTYPE TY
ON TY.TRANSACTIONTYPE_ID = PB.TRANSACTIONTYPE_ID
INNER JOIN TRANSACTIONMODE T
ON T.TRANSACTIONMODE_ID = PB.TRANSACTIONMODE_ID
INNER JOIN LEDGER L
ON L.LEDGER_ID = PD.LEDGER_ID
INNER JOIN LEDGERSUBGROUP LS
ON LS.LEDGERSUBGROUP_ID = L.LEDGERSUBGROUP_ID
LEFT JOIN CORPORATE C
ON C.CORPORATE_ID = PB.CORPORATE_ID
LEFT JOIN EMPLOYEE E
ON E.EMPLOYEE_ID = PB.EMPLOYEE_ID
LEFT JOIN AFFILIATEMEMBER AF
ON AF.AFFILIATEMEMBER_ID = PB.AFFILIATEMEMBER_ID
LEFT JOIN MEMBER M
ON M.MEMBER_ID = PB.MEMBER_ID
WHERE TY.ISDEBIT = 1 AND PB.FLAG = 0 AND T.ISROOMNO = 2
AND (P_TRANSACTIONMONTH IS NULL
OR P_TRANSACTIONMONTH =
TO_CHAR (PB.BILLDATE, 'fmMONTH-YYYY'))
AND (P_LEDGERID IS NULL
OR L.LEDGER_ID IN
( (SELECT COLUMN_VALUE
FROM TABLE(GET_ROWS_FROM_LIST1 (
P_LEDGERID,
GROUP BY L.DESCRIPTION,
LS.DESCRIPTION,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO,
C.NAME || E.NAME || AF.NAME || M.NAME,
L.PRINTNO;
END SP_MONTHLYSALESUMMARY;
GET_ROWS_FROM_LIST1 is a function, which i am using to pass " IN " to oracle. There is no problem with this, since it works fine with one query
REATE OR REPLACE FUNCTION BCLUB1868.GET_ROWS_FROM_LIST1
(L IN LONG DEFAULT NULL, SEP IN VARCHAR2 DEFAULT ',')
RETURN MYVARCHARTABLE1 PIPELINED
AS
L_POS INT := 1;
L_NEXT INT;
L_PART VARCHAR(500);
BEGIN
SELECT INSTR( L, SEP, L_POS) INTO L_NEXT FROM DUAL;
WHILE (L_NEXT>0)
LOOP
SELECT SUBSTR(L, L_POS, L_NEXT - L_POS) INTO L_PART FROM DUAL;
PIPE ROW(L_PART);
SELECT L_NEXT + 1, INSTR( L, SEP, L_POS)
INTO L_POS, L_NEXT FROM DUAL;
END LOOP;
SELECT SUBSTR(L, L_POS) INTO L_PART FROM DUAL;
PIPE ROW(L_PART);
RETURN;
END;
Request help from you all experts in the forumHere it is
CREATE OR REPLACE PROCEDURE SP_GRCS (
P_TRANSACTIONMONTH VARCHAR2,
P_LEDGERID VARCHAR2,
O_RESULTSET OUT TYPES.CURSORTYPE)
AS
BEGIN
OPEN O_RESULTSET FOR
-- Point of sale
SELECT *
FROM ( SELECT L.DESCRIPTION LEDGERNAME,
LS.DESCRIPTION LEDGERSUBGROUPNAME,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO
AS ID,
C.NAME || E.NAME || AF.NAME || M.NAME AS NAME,
SUM(CASE
WHEN PB.EMPLOYEE_ID IS NULL
AND T.ISCREDITTRANSACTIONMODE = 1
THEN
PB.BILLAMOUNT
ELSE
0
END)
MEMBERDEBITAMOUNT,
L.PRINTNO
FROM POINTOFSALEBILL PB
INNER JOIN POINTOFSALEBILLDETAIL PD
ON PB.POINTOFSALEBILL_ID = PD.POINTOFSALEBILL_ID
INNER JOIN TRANSACTIONTYPE TY
ON TY.TRANSACTIONTYPE_ID = PB.TRANSACTIONTYPE_ID
INNER JOIN TRANSACTIONMODE T
ON T.TRANSACTIONMODE_ID = PB.TRANSACTIONMODE_ID
INNER JOIN LEDGER L
ON L.LEDGER_ID = PD.LEDGER_ID
INNER JOIN LEDGERSUBGROUP LS
ON LS.LEDGERSUBGROUP_ID = L.LEDGERSUBGROUP_ID
LEFT JOIN CORPORATE C
ON C.CORPORATE_ID = PB.CORPORATE_ID
LEFT JOIN EMPLOYEE E
ON E.EMPLOYEE_ID = PB.EMPLOYEE_ID
LEFT JOIN AFFILIATEMEMBER AF
ON AF.AFFILIATEMEMBER_ID = PB.AFFILIATEMEMBER_ID
LEFT JOIN MEMBER M
ON M.MEMBER_ID = PB.MEMBER_ID
WHERE TY.ISDEBIT = 1 AND PB.FLAG = 0 AND T.ISROOMNO = 2
AND (P_TRANSACTIONMONTH IS NULL
OR P_TRANSACTIONMONTH =
TO_CHAR (PB.BILLDATE, 'fmMONTH-YYYY'))
AND (P_LEDGERID IS NULL
OR L.LEDGER_ID IN
( (SELECT COLUMN_VALUE
FROM TABLE(GET_ROWS_FROM_LIST1 (
P_LEDGERID,
GROUP BY L.DESCRIPTION,
LS.DESCRIPTION,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO,
C.NAME || E.NAME || AF.NAME || M.NAME,
L.PRINTNO
UNION ALL
-- Guest Registration
SELECT L.DESCRIPTION LEDGERNAME,
LS.DESCRIPTION LEDGERSUBGROUPNAME,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO
AS ID,
C.NAME || E.NAME || AF.NAME || M.NAME AS NAME,
SUM(CASE
WHEN PB.EMPLOYEE_ID IS NULL
AND T.ISCREDITTRANSACTIONMODE = 1
THEN
PB.BILLAMOUNT
ELSE
0
END)
MEMBERDEBITAMOUNT,
L.PRINTNO
FROM GUESTREGISTRATION PB
INNER JOIN GUESTREGISTRATIONDETAIL PD
ON PB.GUESTREGISTRATION_ID = PD.GUESTREGISTRATION_ID
INNER JOIN TRANSACTIONTYPE TY
ON TY.TRANSACTIONTYPE_ID = PB.TRANSACTIONTYPE_ID
INNER JOIN TRANSACTIONMODE T
ON T.TRANSACTIONMODE_ID = PB.TRANSACTIONMODE_ID
INNER JOIN LEDGER L
ON L.LEDGER_ID = PD.LEDGER_ID
INNER JOIN LEDGERSUBGROUP LS
ON LS.LEDGERSUBGROUP_ID = L.LEDGERSUBGROUP_ID
LEFT JOIN CORPORATE C
ON C.CORPORATE_ID = PB.CORPORATE_ID
LEFT JOIN EMPLOYEE E
ON E.EMPLOYEE_ID = PB.EMPLOYEE_ID
LEFT JOIN AFFILIATEMEMBER AF
ON AF.AFFILIATEMEMBER_ID = PB.AFFILIATEMEMBER_ID
LEFT JOIN MEMBER M
ON M.MEMBER_ID = PB.MEMBER_ID
WHERE TY.ISDEBIT = 1 AND PB.FLAG = 0 AND T.ISROOMNO = 2
AND (P_TRANSACTIONMONTH IS NULL
OR P_TRANSACTIONMONTH =
TO_CHAR (PB.BILLDATE, 'fmMONTH-YYYY'))
AND (P_LEDGERID IS NULL
OR L.LEDGER_ID IN
( (SELECT COLUMN_VALUE
FROM TABLE(GET_ROWS_FROM_LIST1 (
P_LEDGERID,
GROUP BY L.DESCRIPTION,
LS.DESCRIPTION,
C.CORPORATENO
|| E.EMPLOYEENO
|| AF.AFFILIATEMEMBERNO
|| M.MEMBERNO,
C.NAME || E.NAME || AF.NAME || M.NAME,
L.PRINTNO)
ORDER BY PRINTNO;
END SP_GRCS;
I have even tried adding L.Ledger_ID in select statement. -
Returning recordset from stored procedures
Hi
I am trying to get a stored procedure to return multiple values (i.e. a recordset) and want to access them from JDBC. Is that possible?
Frankie =:>You can return nested tables and varrays using JDBC. See chapter 10 of the Oracle JDBC Developer's Guide.
http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/toc.htm -
I can't access email from my iPhone 3gs since changing email password
Hi all,
iPhone 3s 16GB
iOS version: 6.1.3
ISP Bigpond Cable
I can't access my email from my iPhone 3GS.
This is an iPhone problem, not an ISP problem.
I know this because I can access my email from both my laptop and webmail.
This is occurring here at home via my WiFi network and also a few kilometres away via 3G.
This morning I had to change the password on my Bigpond Cable internet email account.
Whenever I try to access email from my phone I receive the following error:
"Cannot Get Mail"
"The user name or password for "**** *****" is incorrect."
There are two buttons, one captioned Settings the other OK.
Both the user name and password are correct. This happened perhaps 4 or 5 times in the 6+ years I was with Internode and has happened a couple of times in the 20 months that I've been on Bigpond Cable.
I have re-entered my email account and connection details multiple times to no avail.
I have tried deleting the account, then rebooting my phone and creating a new account, but that didn't work.
I tried deleting the account, turning the phone completely off, waiting one minute and then after turning it back on, creating a new account but that didn't work.
I know I am entering the correct settings because before I deleted the account the first time, I took a series of screen captures from the Settings App and I also have the settings from MS Outlook to refer to.
Its as though somewhere in the phone, the old email password is being stored and being used instead of the new one, but I don't know where that could be except in the Settings app, "Mail, Contacts, Calendars" and that is where I am entering the new password.
The only solutions to this problem I found by searching are those that I have already tried and haven't worked for me.
Reverting to the old password is not an option. My account was compromised by Malware, hence the password change and a complete scan of my laptop.
Any ideas?The problem was resolved by erasing the entire contents of my phone and then restoring it, setting it up as a new phone.
Maybe you are looking for
-
Error while deploying on a cluster
Hi all, when I deploy my WebApp on a cluster I recieved the following error: ####<Dec 13, 2006 5:18:14 PM CET> <Debug> <Deployer> <eb0bzl58> <admdwsgem> <ExecuteThread: '0' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-149078> <Stack trace
-
I went to connect cloud at home and stated that i couldn't do this as I have already downloaded on 2 machines, what can I do to overcome this as I sometimes need to use the other computers. home- labtop - Work warmet regards victor
-
From starter edition to photoshop elements 12
how do we transfer the collections and tags from windows xp (adobe starter edition) to windows 8.1 (adobe photoshop elements 12)? There are close to 200 collections in ADOBE STARTER EDITION 3.2. It looks like elements 12 calls them albums.
-
Need help setting up WRT54G as wireless bridge/repeater
I currently use a WRT54GS as a wireless router. It is located downstairs and can't be moved. I have a few devices upstairs that can't connect to the router because of a weak signal. I can not run a cable upstairs and have a second WRT54G router th
-
Hello, The date format in an Access database is "Date Time" ( 1/8/2008 6:14:34 AM ). It's a required format for some functions. I need to group product orders by date for a simple revenue summary page. As the time part of the date is different for al