Substitution of PLSQL table name
I want to create a PLSQL process that removes rows from a table, that I've identified by an element.This does not work... get the error:
ORA-06550: line 4, column 29: PL/SQL: ORA-00903: invalid table ORA-06550 name: line 4, column 1: PL/SQL: statement ignored
declare
Start
removal of the staging. : P110_TABLE_NAME;
end;
What I do wrong here in the substitution of P110_TABLE_NAME?
Published by: user581839 on December 23, 2008 16:32
Try this way
declare
begin
Execute immediate 'delete from staging.' || trim( :P110_TABLE_NAME);
end;
CITY
Tags: Database
Similar Questions
-
Use of the staging of prepareBulk table name parameter / completeBulk functions.
I try to load 1.6 billion triple in a semantic graph RDF instance. I use the prepareBulk / completeBulk approach described in "7.12 Bulk loading Using RDF graphic semantic support for Apache Jena. I loaded the triplets of. TTL.gz files in an intermediate table with prepareBulk according to the "example 7-10 loading data into the staging (prepareBulk) Table.
Example 7-10, I used "null" for the parameter "staged by the name of the table" at prepareBulk. I then ran a separate program to run completeBulk according to the "example 7-11 loading data into the table of staging in semantic networks (completeBulk). 7-11 watch also the use of "null" as default value for the parameter "staged by the name of the table. PrepareBulk operations seem to have executed successfully with a null value, staging table name. However, null does not seem to be a valid entry for the staging of completeBulktable name parameter. "CompleteBulk (null, null);" run displays the following error message:
Hit the exception ORA-00942: table or view does not exist
What is the relationship between "staged by the name of the table" Settings prepareBulk and completeBulk? Is null, a valid value for this parameter to prepareBulk, and if so what should be the corresponding value passed to completeBulk?
Hello
This seems odd. We have a test for this case. We will try this. By default, the intermediate table created is under the same user schema and table name would be "RDFB_" followed by the name of model.
Can you please verify the existence of such a table in your schema? There must be 1 b + lines. If so, you can directly proceed to the name of the table.
Since you are dealing with a good amount of data, the following should be helpful for performance:
(1) remove the indexes on the table of the application before you run the completeBulk call;
2) enable parallel DML before the call: oracle.executeSQL ("alter session enable dml parallel");(3) use the parallel load options. An example is the following. Degree of parallelism is set to 4, and you will need to customize it to your own configuration.
"PARSE PARALLEL PARALLEL_CREATE_INDEX = 4 mbv_method = shadow"
Thank you
Zhe Wu
-
Get the only table name in model executing the revese engineer but columns do not come
Get the only table name in model executing the revese engineer but columns do not come. I used the standard procedure. Please let me know why I am not getting column in my model.
I have attached the screen shot for the same thing.
This is a table or a synonym? In the case of synonym or try to add the property as it appears below thread.
Reverse engineering a synonym in ODI 11 G.
Or maybe go with personal setbacks.
-
Create procedure upsert (name of the existing table, incoming table name)
Is it possible to create a procedure that makes a merge (upsert) with only two parameters:
- Existing Table name - name of table that will have data merged into it.
- Incoming Table name - name of the table that has developed data day/news.
The method would be:
- Use primary keys on the "existing" table as the condition links
- Fact and update if exists and insert new
- no record
- no clues
- no removal clause
Oracle 11g
MERGE < tip > < table_name >
USING < table_view_or_query >
(< CONDITION >)
WHEN MATCHED THEN < update_clause >
DELETE < where_clause >
WHEN NOT MATCHED THEN < insert_clause >
[ERRORLOG < log_errors_clause > < reject limit < integer | unlimited >];
< table_name > - from input parameter
< table_view_or_query > -socket input parameter
< condition > - primary key links (how search a single/multiple primary keys and return the list?)
< update_clause > - update all columns (other than KP, how to get and use a dynamic list of columns)
< where_clause > - not used
< insert_clause > - insert new records for all columns (including the PK (s))
declare
p_source varchar2 (30): = "EMP_X";
p_target varchar2 (30): = "EMP_Y";
query varchar2 (32000);
function get_cols (p_table in varchar2) return varchar2 is
VARCHAR2 (32000) retval;
Start
Select the Group (order of column_id) listagg (column_name, ',')
in retval
of user_tab_cols
where table_name = p_table
Table_name group;
Return retval;
end;
function get_keys (p_table in varchar2) return varchar2 is
VARCHAR2 (4000) retval;
Start
Select listagg (cc.column_name, ',') in the Group (order by cc.position)
in retval
from user_constraints c,.
user_cons_columns cc
where cc.table_name = p_table
and c.constraint_type = 'P '.
and cc.table_name = c.table_name
and cc.constraint_name = c.constraint_name
C.table_name group;
Return retval;
end;
function merge (p_merge1 varchar2, p_merge2 varchar2, p_link varchar2) return varchar2 is
Merge1 varchar2 (32000): = p_merge1 | «, » ;
merge2 varchar2 (32000): = p_merge2 | «, » ;
VARCHAR2 (32000) retval;
Start
then merge1 is not null
loop
retval: = retval | » t.'|| substr (Merge1, 1, InStr (Merge1, ',') - 1) |'s =.' | substr (merge2, 1, InStr (merge2, ',') - 1);
Merge1: = substr (merge1, instr(merge1,',') + 1);
merge2: = substr (merge2, instr (merge2, ',') + 1);
If merge1 is not null then
retval: = retval | p_link;
end if;
end loop;
Return retval;
end;
Chopper (p_cols p_keys varchar2, varchar2) return varchar2 is
passes varchar2 (32000): = ', '. p_cols | «, » ;
keys varchar2 (32000): = ', '. p_keys | «, » ;
VARCHAR2 (32000) retval;
Start
While the keys! = «, »
loop
If instr (passes, substr (keys, 1, instr(keys,',',1,2))) = 1 then
cols: = substr (collars, instr(cols,',',1,2));
on the other
cols: = substr (passes, 1, instr (passes, substr (keys, 1, instr(keys,',',1,2))) | substr (collars, InStr (collars, ',', InStr (passes, substr (Keys, 1, InStr(Keys,',',1,2))), 2) + 1);)
end if;
keys: = substr (keys, instr(keys,',',1,2));
end loop;
return trim (both ',' collar);
end;
Start
query: = 'merge'. p_target |' t ' |' using (select ' | get_cols (p_source): ' from ' | p_source |') s '.
' on ('|) Merger (get_keys (p_target), get_keys (p_source), 'and') |') ' ||
"When matched then update set ' | '. Merger (Chopper (get_cols (p_target), get_keys (p_target)), Chopper (get_cols (p_source), get_keys (p_source)), ',').
«When not matched then insert ('|)» get_cols (p_target) |') values (s.'|) Replace (get_cols (p_source),', ', ', s') |') ';
dbms_output.put_line (Query);
end;
Fusion in EMP_Y t using (select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO EMP_X) s on (t.EMPNO = s.EMPNO and t.ENAME = s.ENAME) when matched then update set t.JOB = s.JOB, t.MGR = s.MGR, t.HIREDATE = s.HIREDATE, t.SAL = s.SAL, t.COMM = s.COMM, t.DEPTNO = s.DEPTNO when not matched then insert (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) values (s.EMPNO, s.ENAME, s.JOB, s.MGR, s.HIREDATE, s.SAL, s.COMM, s.DEPTNO)
Concerning
Etbin
-
Using variables such as table names. Ideas for alternative designs
Hello
I am the design of an application that uses synonyms to pull information from the 'client' DBs via links from DB. Synonyms are created with a DB_ID in name (example: CUSTOMER_100, CUSTOMER_200... where the 100 and 200 are DB IDs of 2 separate DBs customer.)
I have a procedure that selects data in the synonym based on what DB_ID is passed to the procedure. I want to be able to perform this procedure for any entered DB_ID. I know now I can't use variable for the table names names and using EXECUTE IMMEDIATE does not seem suitable for what I'm trying to do.
Does anyone have suggestions or re-design options, I could use to achieve this generic procedure which will select a certain synonym based on the information of DB input parameters? Thank you.
CREATE or REPLACE PROCEDURE CUSTOMER_TEST (p_host IN VARCHAR2, p_db_name IN VARCHAR2, p_schema in VARCHAR)
IS
v_hostname VARCHAR2 (50): = UPPER (p_host);
v_instance VARCHAR2 (50): = UPPER (p_db_name);
v_schema VARCHAR2 (50): = UPPER (p_schema);
v_db_id NUMBER;
v_synonym VARCHAR2 (50);
CURSOR insert_customer
IS
SELECT
c.customer_fname,
c.customer_lname
OF v_synonym_name c;
BEGIN
-MADE BASED ON INPUT PARAMETERS DB_ID
Select d.db_id
in v_db_id
of t_mv_db_accounts ac.
t_mv_db_instances I,.
t_mv_dbs d,
t_mv_hosts h
where ac.db_ID = d.db_ID
and i.db_ID = d.db_ID
and i.HOST_ID = h.host_id
and upper (H.HOST_NAME) = v_hostname
and upper (D.DB_NAME) = v_instance
and upper (Ac.ACCOUNT_NAME) = v_schema;
-ADD DB_ID TO NAME SYNOYNM
v_synonym: = 'CUSTOMER_ | v_db_id;
FOR cust_rec IN insert_customer
LOOP
INSERT INTO CUSTOMER_RESULTS (First_Name, Last_Name)
VALUES (cust_rec.customer_fname, cust_rec.customer_lname);
END LOOP;
COMMIT;
END;
/
RGS,
Rob
EXECUTE IMMEDIATE ' INSERT IN CUSTOMER_RESULTS (First_Name, Last_Name) SELECT customer_fname, customer_lname FROM ' | v_synonym;
-
How to find all the table names in all modules in EBS R12?
How to find all the table names of all the modules in EBS R12?
In addition, you can go to http://etrm.oracle.com, you select the version of the EBS, select "FND Data" or "S/n data", select the Type of the object TABLE and you will get all the tables of EBS in module.
-
HII all... .i want to Know is it possible to give a table plsql as mode setting of output to another procedure... because if I do, I get an error "PLS-00201: identifier 'EMPTYPE' must be declared" I have creatred an emptype plsql table here is my code "»
create or replace procedure emp_pro (v_data in varchar2, v_empout out varchar2)
is
type emprectype is record
(
V_empno emp.empno%type,
v_ename emp.ename%type,
v_sal emp.sal%type,
v_job emp.job%type,
v_hiredate emp.hiredate%type,
v_comm emp.comm%type,
v_deptno emp.deptno%type
);
is of type emptype table of the emprectype
index of directory;
I have directory: = 0;
v_data varchar2 (1000): =' | 7369, SMITH, 800, CLERK, 17-DEC-80, 0: 20 | 7499, ALLEN, 1600, SELLER, 20-FEB-81 300, 30. 7521, WARD, 1250, SELLER, 22-FEB-81 500, 30. 7566, JONES, 2975, MANAGER, 02-APR-81, 0: 20 | 7654, MARTIN, 1250, SELLER, 28-SEP-91 100, 30. 7839, KING, 5000, PRESIDENT, 17-NOV-81, 0, 10. 7844, TURNER, 1500, SELLER, 08-SEP-81, 0: 30 | 7876, ADAMS, 1100, CLERK, 23-MAY-87, 0: 20 | 7900, JAMES, 950, CLERK, 03-DEC-81, 0: 30 | 7902, FORD, 3000, ANALYST, 03-DEC-81, 0: 20 | 7934, MILLER, 1300, CLERK, 23-JAN-82, 0: 10 |';
v_record varchar2 (100);
number of v_num1;
number of v_num2;
number of v_num3;
i the number;
number of j;
Meter number;
Start
Counter:=length(v_data)-length(Replace(v_data,'||')).
i: = 1;
loop
v_num1: = instr (v_data,'|) (', 1, i) + 2;
v_num2: = instr(v_data,'||',1,i+1)-2;
v_num3: = (InStr(v_data,'||',1,i+1))-(InStr(v_data,'||',1,i) + 2);
i: = i + 1;
v_record: = substr (v_data, v_num1, v_num3);
exit when I = counter + 1;
v_empout: = v_record;
-dbms_output.put_line (v_record);
end loop;
end emp_pro;
/
The type that you created is local to the procedure and is valid within this procedure.
To use the same type between procedures, you create a type that is visible in both procedures, for example by creating a type in the header of a packet.
-
Table names are stored in a separate table; How can I use the domain as table name?
Dear Experts,
My version of oracle is,
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0-Production
AMT for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
I stored the table names in a separate table as
Table name: all_table
Fields are: table_id, table_name, desc
record of the sample: 1, EMP, EMPLOYMENT DETAILS
Now I want to select all the contents of a perticular table, his name is all_table.
(ie)
Select * from (select table_name from all_table where table_id = 1);
But it is not listing the details of the EMP table. Its poster simply the name of the field "EMP".
Please help me in this regard.
Hello
Whenever you make dynamic SQL statements, you must place the dynamic whole statement in a single string variable. When debugging, display this string before running it. If you get a runtime error that will show you the statement he makes, which often made the obvious cause. For example:
DECLARE
CURSOR c IS
SELECT table_name
From user_tables;
CNT NUMBER;
sql_txt VARCHAR2 (1000);
BEGIN
FOR ut IN t
LOOP
sql_txt: = 'SELECT COUNT (*).
|| « DE » ' || t.table_name | '"';
dbms_output.put_line (sql_txt |) "= sql_txt"); -For debugging
EXECUTE IMMEDIATE sql_txt INTO cnt;
dbms_output.put_line (' Table: ')
|| t.table_name
|| ' ('
|| CNT
|| "lines)"
);
END LOOP;
END;
/
You can comment the put_line extra call when you are convinced that sylvie statement works.
If you have non-standard table names (for example, names that contain spaces) you must place the names of the tables in double - quotes, as I did above.
-
Corresponding global APEX box table name issue
Hello
I learn how to use the checkbox element and try to get the values of options checked through paintings global application. So, this can be a simple enough question, but I'm completely stuck here...
When I was looking through different discussions and guides, I met the checkbox corresponding names of painting as 'g_f01' - 'g_f50 '. And so far I have seen that these names are derived from the name of the element in the generated HTML code, for example:
< input type = "checkbox" name = "" * f10 * "value ="3"/ >"
And this one is the abbreviation of name of table "g_ * f10."
However, when I tried to do the same thing: I get point name that looks at "* p_v04 *", and therefore, I cannot understand, what table name should I choose to address it correctly :(
My generated HTML code:
< input type = "checkbox" id = "P6_ANSWER_0" name = "" * p_v04 * "value ="3"/ >"
Thanks in advance.1007219
The array of names apex_application.g_f01 - apex_application.g_f50 are used for tabular forms.
What you have is a page element. And a box page can be referenced to use as any other page element. Especially with his name.
In your case P6_ANSWER.There is one thing to look out for. If the LOV you defined for the page box element has multiple values. Then more then 1 box will be shown for this element of the page. And the values saved are stored in the element in the form of colon delimited values.
Nicolette
-
table name not valid error when inserting values into a table
I use the following statement to insert values into a table:
curs. Execute ("INSERT INTO _ * '%s' * _ VALUES ((SELECT MAX (REC_ID) + 1 OF GSAP_MSG_IN), (SELECT MAX (gsap_msg_id) + 1 OF GSAP_MSG_IN), 'SHELLSAP', sysdate, '%s', EMPTY_BLOB(), 1, SYSDATE, EMPTY_BLOB (), SYSDATE)" %(*table_name*,file_extension)) ")
whence table_name the following statement
table_name = ' config.staging_db_tablesNames ['in_msgs]
as I created a configuration file for all parameters that can change. The value of the table in the audit using a print command is correctly, but when put in the query above to run the insert statement gives an error. The following is the summary of comprehensive performance where you can see the table name as
$ python gsapscnr.py
Vote for the data files in/home/mh/inbox /...
GSAP_MSG_IN
Traceback (most recent call changed):
File "gsapscnr.py", line 147, in it?
poll_for_data()
File "gsapscnr.py", line 86, in poll_for_data
Sorter = load_details_first)
File "gsapscnr.py", line 42, survey
curs. Execute ("INSERT INTO '%s' VALUES ((SELECT MAX (REC_ID) + 1 OF GSAP_MSG_IN), (SELECT MAX (gsap_msg_id) + 1 OF GSAP_MSG_IN), 'SHELLSAP', sysdate, '%s', EMPTY_BLOB(), 1, SYSDATE, EMPTY_BLOB (), SYSDATE)" %(table_name,file_extension)) ")
cx_Oracle.DatabaseError: ORA-00903: invalid table name
Can anyone help with this problem please. I'm passing the value of the table in a bad way. Also if anyone can suggest a good tutorial for paythong programming using cx_Oracle.
ConcerningPrint the SQL string that you establish, cut and paste it this output in SQL * more and see if it runs. This may show you that you should remove the single quotes around the name of the table %s in the Python file.
-
How to recover data from plsql table in the BI publisher data model
Hi all
I created a data model for XML editor report. In the data model I m get plsql table data. for this I created a package with a function in the pipeline. I am able to run sql in sql developer. But if I run the program at the same time, then I got error like "java.sql.SQLSyntaxErrorException: ORA-00904:"XXXXX": invalid identifier.
I used the same settings in the data model and simultaneous program...
Please tell me what to do...
Thanks in advance...
Kind regards
DossI think P_ORG_ID is the parameter
so use:P_ORG_ID
-Add
also why not use simple sql query?Published by: Alexandr Sep 14, 2012 04:48
-
How to give the table name as input for the insertion procedure parameter
Hello
Could a little help in this scenario,
Here is an example of how to insert,
where the 'b' table name will change at each
is there a possible way to keep the name of the table as an input parameter
SQL > CREATE or REPLACE PROCEDURE PROC_INSERT as
BEGIN 2
3 INSERT INTO A
4 (ID, NAME, LOC)
5. SELECT ID, NAME, B LOC;
6 VALIDATION;
7 END;
Kind regards
VikramIf you need to pass the object name to a SQL running, you must use dynamic SQL statements.
A simpler way is the following
create or replace procedure proc_insert ( pTableName varchar2 ) as begin execute immediate 'insert into a (id, name, loc) select id, name, loc from ' || pTableName; commit; end;
-
Reconciliation error: ORA-00903: invalid table name
I am facing this error below:
SELECT * FROM WHERE ORC_KEY =? AND UD_RES_P_KEY =? : java.sql.SQLSyntaxErrorException: ORA-00903: invalid table name
What is a product of IOM 9.1.0.2 problem?
Best regards
RobertNo, it isn't a matter of product. Please go to the tab of process definition and
define any attribute with multiple values as a key field in mapping definition of the reconciliation process.Let me know the result, if you please.
hope this helps,
Thiago Guimarães L -
java.sql.SQLException: ORA-00903: invalid table name
Guys,
I get this error. Could you help me on this?
08:58:23, 859 ERROR [DATABASE] select * where orc_key = 125 and _key not
in (null) and UD_MAINU_key = 98
java.sql.SQLException: ORA-00903: invalid table name
to
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:108)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:340)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:301)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:813)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:253)
to
oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:890)
to
037)
to
oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:901)
to
155)Go to metalink and look at this note ID 443436.1.
hope this helps,
Thiago Leoncio -
Hi all
I have almost 70 procedures in my database.
I want to get all the names of the different tables used in the procedures of 70.
Is this possible?
Note:
All the table names are prefixed by the name of schema as DEVSRC.table_name.
Please advice
Thank you
JOJohney says:
Hi, VTA doubt.
This query will give the names of the tables to only select stmt used in the procedure
or
List of table names that accompany in all DML operations inside the procedure?
Thank you
JOIt will give all the table to be used in select or any DML...
You can also view by creating a temp proc
SQL> drop procedure proc_test; Procedure dropped. SQL> select name, referenced_name, dependency_type from user_dependencies 2 where type = 'PROCEDURE' and referenced_type = 'TABLE' and name='PROC_TEST'; no rows selected SQL> create or replace 2 PROCEDURE proc_test 3 IS 4 v_ID number; 5 v_PRID number; 6 v_PRLID number; 7 v_DATERECEIVED date; 8 Cursor C1 is 9 select * from table_c; 10 BEGIN 11 open c1; 12 LOOP 13 FETCH c1 INTO v_ID,v_PRID,v_PRLID,v_DATERECEIVED; 14 EXIT WHEN c1%NOTFOUND; 15 insert into table_b values(v_ID,v_PRID,v_PRLID,v_DATERECEIVED); 16 Commit; 17 END LOOP; 18 CLOSE C1; 19 END; 20 / Procedure created. SQL> select name, referenced_name, dependency_type from user_dependencies 2 where type = 'PROCEDURE' and referenced_type = 'TABLE' and name='PROC_TEST'; NAME ------------------------------ REFERENCED_NAME DEPE ---------------------------------------------------------------- ---- PROC_TEST TABLE_B HARD PROC_TEST TABLE_C HARD SQL>
Concerning
Umesh
Maybe you are looking for
-
Series 2 GPS mapping works is not without an iPhone?
I tried run/walk with the following applications without my iPhone, but they don't display any map of my route in activity CA. seems like it should always be attached to the phone to follow? RunKeeper Apple training app (run/walk in the open air) Run
-
HP Pav DV6 6170sl, RAM upgrade?
Hello, I have a Pavilion DV6 6170sl with 8 GB of RAM (4 GB x 2 - DDR3 SDRAM SODIMM MT16JSF51264HZ - 1-4). It is possible to change with 16 GB (8 x 2 GB)? The equivalent model for Micron Technology of 8 GB is DDR3 SDRAM SODIMM MT16JTF1G64HZ - 1 4. Mot
-
Problem Windows Installer for windows 7
Cannot install anything. Gives always error windows install not available. I tried the messages on the internet. They do not work Nothing under the works here https://support.Microsoft.com/en-CA/KB/2642495
-
Using the Menu button to close the Application
Hi all, as a topic, I would like to ask how to implement the menu button to close the application? I mean there is option close when I'm menu press the button you want to close the application, if I press on it, what should I do about it?, thanks for
-
Signature collision - 2 WD USB external hard drives
I can't get two discs to be active at the same time - when I look in disk management - it is to get the error message. This disk is offline due to the collision of signing with another disc This does not happen with another computer with Win 7 Home p