Can't access Table inside the stored procedure
Pls Me suggest good way
The problem that I face that I created a user user1 and create a global temporary table under that user. Then I "select" Developer sql query this time under another user (User0) as select * from user1.gtt_table; successfully, it runs and return results. also can also insert data into user1.gtt_table.
But if I try to use Insert or select user1.gtt_table and error
- Error (798,29): PL/SQL: ORA-00942: table or view does not exist
am I something wrong or missing any step?
Connect as user1 for this.
Tags: Database
Similar Questions
-
Describe the Table inside the PLSQL procedure
Dear all,
I write a procedure which takes tablename as input and displays these columns in the table as output. How to describe a table within a plsql procedure. Also how to display columns, because each table will have a different number of columns. Please suggest.
Thank you and best regards,
MaheshHello
You can have a procedure like thisCREATE OR REPLACE PROCEDURE retrieve_tab_cols_prc(l_table_name VARCHAR2,l_owner_name varchar2) AS CURSOR TAB_COL_CURSOR IS select * from all_tab_cols where table_name = l_table_name and owner = l_owner_name ORDER BY column_id; BEGIN FOR CUR_REC IN TAB_COL_CURSOR LOOP dbms_output.put_line(CUR_REC.COLUMN_ID||' : '||CUR_REC.COLUMN_NAME); END LOOP; END retrieve_tab_cols_prc; Procedure created. SQL> begin 2 RETRIEVE_TAB_COLS_PRC('EMP','SCOTT'); 3 end; 4 / 1 : EMPNO 2 : ENAME 3 : JOB 4 : MGR 5 : HIREDATE 6 : SAL 7 : COMM 8 : DEPTNO
-
By using the parameter as a column in a select statement inside the stored procedure.
I'm doing a variation of what follows. Can someone tell me how to use the parameter passed in the IN clause correctly? Thank you
Deleted table.drop table test1; drop table test2; CREATE TABLE TEST1 ( COL1 NUMBER ); CREATE TABLE TEST2 ( COL2 NUMBER ); insert into test1 values (1); insert into test2 values (1); commit; create or replace procedure test_sp (col_name varchar2) as var1 number; begin select col1 into var1 from test1 where col1 in (select col_name from test2); end; exec test_sp ('COL2');
Deleted table.
Table created.
Table created.
1 line of creation.
1 line of creation.
Validation complete.
Created procedure.
BEGIN test_sp ("COL2"); END;
Error on line 29
ORA-01722: invalid number
ORA-06512: on-site ".» TEST_SP', line 7
ORA-06512: at line 1You must use dynamic sql statements:
SQL> drop table test1; Table dropped. SQL> drop table test2; Table dropped. SQL> CREATE TABLE TEST1 2 ( 3 COL1 NUMBER 4 ); Table created. SQL> CREATE TABLE TEST2 2 ( 3 COL2 NUMBER 4 ); Table created. SQL> insert into test1 values (1); 1 row created. SQL> insert into test2 values (1); 1 row created. SQL> commit; Commit complete. SQL> create or replace procedure test_sp (col_name varchar2) 2 as 3 var1 number; 4 begin 5 execute immediate 'select col1 from test1 where col1 in (select ' || col_name || ' from test2)' into var1; 6 end; 7 / Procedure created. SQL> exec test_sp ('COL2'); PL/SQL procedure successfully completed. SQL>
SY.
-
Insert special character in the table containing the stored procedure
Hello
I'm running into a situation where I need to insert values such as
But it went from an input parameter to a procedure where my Insert statement looks likespeci'al special & not so' special
where p_values is an input parameter.Insert into my_Table (col1) Values (p_value);
I tried to look online, but all solutions are associated with sql * plus using game, I don't know how we can do it, any help/idea will be useful.
Thank you!user10647455 wrote:
I'm looking for something like thisdeclare my varchar2(30); begin my := 'syn"Special"Char's/check/'; mycode(q'[my]'); commit; end; /
It works:
declare my varchar2(30); begin my := Q'[syn"Special"Char's/check/]'; mycode (my); end; /
-
How can I access methods inside the content of the loader?
I posted a similar question in the General Discussion, but, when I insert a SWF with the Loader class, how do you get variables and methods on this SWF? Is this possible?var externalSWF:MovieClip = _loader.content; or _loader.getChildAt (0);
externalSWF.whatever ();If it's an external swf and you do not know the type, you can either have the external swf extend a package in your calling swf file or use:
var fn:Function = externalSWF ["somefunctionname"];
FN. Apply (externalSWF, [param1, param2]) -
How to create a table in a stored procedure
Please help me to answer the following question...
How to create a table inside the stored procedure... I want a detailed explanation... Please help mePlease see this link:
http://tinyurl.com/cmq5vo -
Unexpected token: the error that occur inside a stored procedure
I get an unexpected token error when you try to compile the following stored procedure. The error occurs on the run pk_proof.pr_ProofAssets inside the stored procedure exec statement. No reason?
CREATE OR REPLACE PROCEDURE MONTHLY_ASSET (ln_business_dt_num IN NUMBER DEFAULT NULL, missing_tbl_name OUT NOCOPY VARCHAR2) IS ln_business_dt_num NUMBER; missing_tbl_name VARCHAR2; no_tbl_name_found EXCEPTION; bad_date_value EXCEPTION; counts_not_matched EXCEPTION; BEGIN IF ln_business_dt_num < 0 THEN RAISE bad_date_value; ELSE Select MAX(business_dt_num) into ln_business_dt_num FROM sasor.dp_ca_proof; if missing_tbl_name IS NOT NULL then raise no_tbl_name_found; end if; exec pk_proof.pr_ProofAssets('SLH_DST_ASSET', ln_business_dt_num, 'sasor_batch');
Remove 'exec '.
-
Can not see all the stored procedures in the Entity Data Model Wizard
I hope it is a simple oversight on my part I try to use the new beta version of odp.net with entity framework support. I can open the Entity Data Model Wizard, give him my information database, and I can choose various tables to use successfully. But in the list where I select the tables, views and stored procedures, the wizard does not see my stored procs or my point of view.
Does anyone know why he would see the tables but not views or stored procedures? My procs can be found under "packages" If that makes a difference. I tried to create a fictional stored procedure at the level above the title of 'procedures', but it is unclear whether.
Is it possible for me to debug this from here? The log files, I could watch that would help me?
Thank you
JimI belive your Oracle database 10 g such as 9iR2 predates.
ODP/EF Beta does not list the stored procedures or functions when connect you to a database Oracle 10 g before.Readme.txt:
4. the procedures are not compatible with the DB 9.2.
Thus, there is no stored procedure listed by the EDM Wizard for 9.2 DBs. -
In a table - looping through the rows and the stored procedure call
APEX version: 3.2.0.00.27
Hello
I searched the forum and tried a few things but could not make it work.
I have a tabular presentation, developed with the help of the ATD ( )
What I'm trying to do now:
-After submit and validations, loop through all the lines and
-call a stored procedure passing 3 parameters obtained from each of the lines on the form of tables. This procedure will be an update of a database table.
On the forum, I found that I could do the loop "* FOR i IN 1..." APEX_APPLICATION.g_f03. "LOOP COUNT *" syntax.
Only for testing purposes, I tried just to view information with the following (On Load - after a footer) process (example of Denes Kubicek == > http://deneskubicek.blogspot.com/2009/05/execute-javascript-throuhg-plsql.html):
The foregoing would give me a ' * ORA-01403: no data found * ' message. I tried through various variants of APEX_APPLICATION.g_f0* #*, but still can't get anything to display correctly. In commenting on all the lines referring to APEX_APPLICATION.g_f0x above, the date would be are they displayed fine.declare v_today varchar2 (200); begin -- :P40_test := APEX_APPLICATION.g_f03(1); -- :P40_test2 := APEX_APPLICATION.g_f04.COUNT; :P40_test2 := 100; v_today := to_char (sysdate, 'dd.mm.yyyy'); --FOR i IN 1.. APEX_APPLICATION.g_f03.COUNT LOOP :P40_test := APEX_APPLICATION.g_f02(2); HTP.p ('<script type="text/javascript">'); HTP.p ( 'alert(''Today is ' || v_today -- || APEX_APPLICATION.g_f04(APEX_APPLICATION.g_f03(i)) || '.\n' || 'end!'');' ); HTP.p ('</script>'); -- :P40_test := APEX_APPLICATION.g_f02(APEX_APPLICATION.g_f02(i)); --END LOOP; end;
I tried uncomment the FOR... LOOP and play with the code (defining the process runs "On submit - after calculations" and Validations), I got was a ' * ORA-06502: PL/SQL: digital error or value: character conversion number error * "message.
Here is the script of the form in a table:
Regarding the parameters for the stored procedure, it would the MSLINK, VALVE_NUMBER and the VALVES_STYLE. FEATURE.select "V"."MSLINK", -- hidden (number) "V"."INSTALLATION_DATE", -- editable date picker "V"."MANUFACTURER_INDICATOR", -- editable (cascading LOV -- text) "V"."MODEL_INDICATOR", -- editable (cascading LOV -- text) "V"."DIAMETER_INDICATOR", -- editable (LOV -- number) "V"."PURPOSE_INDICATOR", -- editable (LOV -- text) "V"."VALVE_NUMBER", -- shown but not editable -- number "V"."MODIFY_DATE", -- shown but not editable "V"."MODIFY_USER", -- shown but not editable "V"."VALVES_STYLE"."FEATURE" -- shown but not editable -- number from "#OWNER#"."VALVES" "V" Where "V"."PROJECT_ID" = :P1_PROJECT_NUMBER AND "V"."VALVES_DFLAG" = 0
Help, please!
(Sorry for the long post).
Thank you
TanHi, Tan,
I have not seen that type of object - I've only used custom types for purposes of test years ago and have never used their within Apex!
One possibility is that the value of checksum being is based on all of the content of these fields, rather than only the part of the FEATURE. If there are other parts of the object, you could include those items as well.
Otherwise, as you f01 KP for a record, you will need to retrieve the values of the FUNCTION in your PL/SQL code directly from the table (because the user cannot modify these fields, you can be sure that the values in the table will be still valid).
Andy
-
Hello
How can I force DAC to run always full load for one of the task that executes the stored procedure? And remaining tasks load incremental in the second and sub sequent executions.
Thank you
Jay.
Hi if your task is running an informatica mapping you can set your DAC task to run the full mapping for incremental and full loads, so tab task just point to the mapping.
Hope that helps.
Thank you
-
can I export and import my database to oracle via the stored procedure?
Hi all
I need to export my database using the stored procedure, the stored procedure is called by the java application and it works well
Now I still get the "ULTIMATE QUESTION", could export and import the database using the stored procedure?
Really thanks for the reply.
Kind regards
KahlilHello
I think you can use DBMS_DATAPUMP (10.1 +), see [DBMS_DATAPUMP | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_datpmp.htm#i1007277], for examples, see [http://www.psoug.org/reference/dbms_datapump.html]
Kind regards
-
Hello
I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...
HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport "
... ");resCode = DBExecutePreparedSQL (hstmt);
resCode = DBClosePreparedSQL (hstmt);
... but in this case, I am not able to read the return value of the stored procedure.
I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?
No idea how to solve my problem?
Cake of KR
DianaS salvation,
Thanks for your comments. During this time I found another way which fullfill my needs:
resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);
sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)
{
/ * Enter values in the record. */
resCode = DBGetColInt (hstmt, 1, & s32_TestId);
}resCode = DBDeactivateSQL (hstmt);
sz_Buffer is the content of the XML file.
Cake of KR
-
Materialized view, based on the stored procedure
Hi all
is it possible to create a materialized view on the results returned by a stored procedure?
If this is not the case, do you think that any other way except for filling a table with data from the stored procedure and then founded the MV on it?
Thanks in advance.
MichaelTsilikidis wrote:
Sorry I don't speak properly. In fact the procedure does not return a value, it fills one of its parameters (of the ref cursor type) of data. That's what I wanted.
No it's not.
REF CURSOR don't store data, so it's not possible.
A Ref cursor is just a pointer to a query... and you can't "select from" a ref cursor, you can retrieve only one open.
PL/SQL 101: Understand the Ref Cursor
As correctly stated above, you can't question from a procedure to a function, and a materialized view is based on a query, you cannot use a procedure in a materialized view.
You could use a function pipeline instead of a procedure, or have the pipeline function obtain the results of the procedure and pipelines, and then the materialized view could be based on the results of this function in the pipeline.
example of function pipeline:
SQL > CREATE or REPLACE TYPE AS OBJECT num_descript (num number, descript varchar2 (30))
2.Type of creation.
SQL >
SQL > CREATE or REPLACE TYPE tbl_num_descript AS TABLE OF THE num_descript
2.Type of creation.
SQL >
SQL >
SQL > CREATE or REPLACE PACKAGE AS-reftest
2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED;
3 END;
4.Package created.
SQL >
SQL > CREATE or REPLACE PACKAGE BODY AS-reftest
2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED IS
3 v_obj num_descript: = num_descript (NULL, NULL);
4 v_rc sys_refcursor;
5 BEGIN
6. IF p_choice = 1 THEN
7 v_rc OPEN to SELECT empno as num, ename like descript FROM emp;
8 ELSIF p_choice = 2 THEN
9 OPEN v_rc to SELECT deptno as num, dname as descript OF THE Department;
10 END IF;
11 LOOP
12 FETCH v_rc INTO v_obj.num, v_obj.descript;
EXIT 13 WHEN v_rc % NOTFOUND;
14 PIPE ROW (v_obj);
15 END LOOP;
16 v_rc NARROW;
RETURN 17;
18 END;
END 19;
20.Package body created.
SQL > select * from table (reftest.pipedata (1));
DESCRIPT NUM
---------- ------------------------------
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
KING 7839
7844 TURNER
7876 ADAMS
JAMES 7900
7902 FORD
7934 MILLER14 selected lines.
SQL > select * from table (reftest.pipedata (2));
DESCRIPT NUM
---------- ------------------------------
10 ACCOUNTING
SEARCH 20
30 SALES
40 OPERATIONS -
user_table should be used in the stored procedure.
Hello
I want to find my permanent table user_tables and then drop and recreate it,
I can use this user_tables in my stored procedure for above purpose or is there any notice that must be used.
SP is admin sp, used to run in offline mode.
yorus truly
Published by: 944768 on 10 February 2013 23:44
Published by: 944768 on 10 February 2013 23:44944768 wrote:
but I wanted to know that can I use user_table in above proc stored to conclude and then drop and create it when Everitt runs?Oracle manages two "flavors" of the stored procedure - copyright and rights of the Summoner. Rights of the DEFINER (default) is always performed under stored security area of the owner of the procedure no matter who calls it. So, if you ask USER_TABLES (or any display USER_, besides) within DEFINER rights stored procedure, you will get a list of tables owned by the owner of the stored procedure, not stored calling procedure. Rights (AUTHID CURRENT_USER) stored Invoker procedure is always carried out under the domain of the calller security. Therefore, if you are querying USER_TABLES (or any display USER_, besides) within the Summoner rights stored procedure you will get a list of tables belonging to the appellant a stored procedure. Hope it answers your question.
SY.
-
Error on the definition of the stored procedure in the simultaneous program
Hello
I created a stored procedure and wanted it attached to the concurrent program. The purpose of this stored procedure when you run it in simultaneous program, the system retrieves the data from the csv file downloaded from the server, then it will insert in the tables of SO / the Interface API. Below, the error occurred.
* Starts * 18 April 2012 18:18:42
Error ORACLE 6550 in FDPSTP
Cause: FDPSTP failed due to the ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in the call to 'SPKO1 '.
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Steps I did to set the stored proc
< < simultaneous executable program > >
Executable: RDRAGON_SO_IMPORT
Short name: RDRAGON_SO_IMPORT
Application: Order management
Method of execution: PL/SQL, stored procedure
Run file name: SPKO1
< < concurrent program - set > >
Program: RDRAGON SO IMPORT
Short name: RDRAGON_SO_IMPORT
Application: Order management
Name of executable: RDRAGON_SO_IMPORT
Method: PL/SQL, stored procedure
Format: text
No set
-Here are my stored procedure-
CREATE OR REPLACE PROCEDURE APPS. SPKO1 IS
FH UTL_FILE. TYPE_DE_FICHIER;
v_line VARCHAR2 (32767).
v_source_id NUMBER (10);
v_created_by NUMBER (10);
v_creation_date DATE;
v_org_id NUMBER (10);
v_orig_sys_docref VARCHAR2 (50);
V_Customer VARCHAR2 (360);
v_customer_prev VARCHAR2 (360);
v_sold_to_org NUMBER (10);
v_orig_line_ref NUMBER (10);
v_item_code VARCHAR2 (2000);
v_ordered_qty NUMBER (10);
v_selling_price NUMBER (10);
v_count NUMBER (10);
v_stat NUMBER;
/******************************************************************************
NAME: SPKO
PURPOSE:
REVISIONS:
Worm Date Description of the author
--------- ---------- --------------- ------------------------------------
1.0 16/04/2012 administrator 1. Created this procedure.
NOTES:
Keywords to replace automatically available Auto:
Object name: SPKO
SYSDATE: 16/04/2012
Date and time: 16/04/2012, 17:55:42 and 16/04/2012 17:55:42
Username: admin (set in Options of TOAD, editor of the procedure)
Name of the table: (defined in the dialog box "New PL/SQL object")
******************************************************************************/
BEGIN
v_source_id: = 6;
v_created_by: = - 1;
v_org_id: = 204;
v_customer_prev: = null;
v_orig_line_ref: = 0;
v_stat: = 0;
SELECT header_id in (DE) v_orig_sys_docref
Select header_id
of OE_ORDER_HEADERS_ALL
creation_date desc order
) WHERE ROWNUM = 1;
FH: = UTL_FILE. FOPEN ('XXANDDIR2', 'myfile1.csv', 'R', 32767);
< < file_read_lines > >
LOOP
BEGIN
UTL_FILE. GET_LINE (fh, v_line);
V_Customer: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 1") ',' "') ','" ');
v_creation_date: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 2") ',' "') ','" ');
v_item_code: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 3") ',' "') ','" ');
v_ordered_qty: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 4") ',' "') ','" ');
v_selling_price: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 5") ',' "') ','" ');
v_orig_line_ref: = (v_orig_line_ref + 1);
If v_stat = 0 then
v_orig_sys_docref: = (v_orig_sys_docref + 1);
end if;
SELECT hca.cust_account_id from v_sold_to_org
OF hz_cust_accounts AOB.
HP hz_parties
WHERE hca.party_id = hp.party_id
AND hca.request_id is null
AND hp.party_name = v_customer;
If v_stat = 0 then
INSERT INTO OE_HEADERS_IFACE_ALL)
order_source_id,
orig_sys_document_ref,
org_id,
CREATION_DATE,
created_by,
last_update_date,
last_updated_by,
operation_code,
sold_to_org_id,
booked_flag)
VALUES)
v_source_id,
('TEST' | v_orig_sys_docref).
v_org_id,
v_creation_date,
v_created_by,
v_creation_date,
v_created_by,
"INSERT."
v_sold_to_org,
'Y') ;
commit;
end if;
INSERT INTO OE_LINES_IFACE_ALL)
order_source_id,
orig_sys_document_ref,
orig_sys_line_ref,
inventory_item,
org_id,
ordered_quantity,
unit_selling_price,
unit_list_price,
CREATION_DATE,
created_by,
last_update_date,
last_updated_by,
operation_code)
VALUES)
v_source_id,
('TEST' | v_orig_sys_docref).
v_orig_line_ref,
v_item_code,
v_org_id,
v_ordered_qty,
v_selling_price,
v_selling_price,
v_creation_date,
v_created_by,
v_creation_date,
v_created_by,
"INSERT");
commit;
v_customer_prev: = v_customer;
If v_customer_prev = v_customer then
v_stat: = 1;
on the other
v_stat: = 0;
end if;
-DBMS_OUTPUT. Put_line ('Col1: ' | v_source_id |', Col2: ' | v_creation_date |', Col3: ' | v_created_by |', Col4: ' | v_updated_date |', Col5: ' | v_updated_by);
EXCEPTION
WHEN NO_DATA_FOUND THEN
OUTPUT file_read_lines;
END;
END LOOP;
SELECT count (*) in the OE_HEADERS_IFACE_ALL v_count;
DBMS_OUTPUT. Put_line (' record Total inserted successfully: ' | v_count);
UTL_FILE. FCLOSE (FH);
END SPKO1;
/
But when I run the stored procedure using TOAD his work.
Help, please. This is my first time to attach the stored procedure in the concurrent program.
Thank you very much.
Kind regards
Diane
Published by: peopsquik08 on April 18, 2012 03:58as clive_t solier
>
You must explicitly reference the settings out
>Try
DECLARE VFILE VARCHAR2(32767); V_SOURCE_ID NUMBER; -- ERRBUF VARCHAR2(200); RETCODE NUMBER; BEGIN VFILE := 'myfile1.csv'; V_SOURCE_ID := 6; --APPS.OMORDERLOADER.SPKO1 ( VFILE, V_SOURCE_ID ); --COMMIT; APPS.OMORDERLOADER.SPKO1( ERRBUF => ERRBUF, RETCODE => RETCODE, VFILE => VFILE, V_SOURCE_ID => V_SOURCE_ID ); END;
but the code above to test your proc
to run concurrent SQL, you can use fnd_submit.submit_program
Maybe you are looking for
-
How can I view my list of calendar items in iCal as I do on my iPhone?
Does iCal allow a view of calendar items in a drop-down list on my mac, the way it does on my iPhone/iPad? If so, how? Thank you!
-
I have not changed my security warnings.
-
Why is my pic jpeg analysis always at 300 dpi. ? I select 150 dpi on the Panel of the scanner, but it always ends up 300 on the computer?
-
Laptop computer connection problems Toshiba for HP Officejet Pro 8610
Hi, I just unpacked my new HP Officejet Pro 8610 and after close to two hours still unable to connect it with my laptop. I have a Toshiba Satellite S55 A5257 8.1 Windows running. The printer shows that it is connected to the correct network (with n
-
restore a previous version of first pro
I installed the latest version of PP 2015 but I crushed my previous version 7.2.1. I used this version because CC 2014 was unstable and would crash constantly. I was told that I had to create a new project instead of load a project from an earlier ve