Table Name Substitution with a variable
I have the following procedure....
LOOP
FETCH table_cur INTO table_rec;
EXIT WHEN NOT table_cur%FOUND;
TableID := table_rec.TableName;
Office := table_rec.OfficeNum;
Client := table_rec.CliNum;
IF Office = 'Y' AND Client = 'Y' Then
UPDATE TableID
SET OfficeNum = (SELECT OfficeNum
FROM Comd02a
WHERE Comd02a.CliNum = TableID.CliNum
AND Comd02a.LoanNum = TableID.LoanNum);
END IF;
END LOOP;
CLOSE table_cur;
TableID is a vaiable and I keep coming back with an error... How
do I make a reference to a table through a variable...
Thanks in Advance
Sally
null
Hi Sally,
The way this is usually handled in Oracle is to use the DBMS_SQL
package provided with the database to run Dynamic SQL, although
I hear that Oracle 8.1.5 (8i) supports Dynamic SQL without the
use of the DBMS_SQL package. I can only personally tell you
that DBMS_SQL has worked like a charm for me on several
occasions. You'll find reference to this package in several
places, but the best place for explanation is the Oracle Press
book: Oracle PL/SQL Programming.
Hope that helps,
Rob
Sally (guest) wrote:
: I have the following procedure....
: LOOP
: FETCH table_cur INTO table_rec;
: EXIT WHEN NOT table_cur%FOUND;
: TableID := table_rec.TableName;
: Office := table_rec.OfficeNum;
: Client := table_rec.CliNum;
: IF Office = 'Y' AND Client = 'Y' Then
: UPDATE TableID
: SET OfficeNum = (SELECT OfficeNum
: FROM
Comd02a
: WHERE Comd02a.CliNum = TableID.CliNum
: AND Comd02a.LoanNum =
TableID.LoanNum);
: END IF;
: END LOOP;
: CLOSE table_cur;
: TableID is a vaiable and I keep coming back with an error...
How
: do I make a reference to a table through a variable...
: Thanks in Advance
: Sally
null
Similar Messages
-
Table Name Substitution with a varaible
I have the following procedure....
LOOP
FETCH table_cur INTO table_rec;
EXIT WHEN NOT table_cur%FOUND;
TableID := table_rec.TableName;
Office := table_rec.OfficeNum;
Client := table_rec.CliNum;
IF Office = 'Y' AND Client = 'Y' Then
UPDATE TableID
SET OfficeNum = (SELECT OfficeNum
FROM Comd02a
WHERE Comd02a.CliNum = TableID.CliNum
AND Comd02a.LoanNum = TableID.LoanNum);
END IF;
END LOOP;
CLOSE table_cur;
TableID is a vaiable and I keep coming back with an error... How
do I make a reference to a table through a variable...
Thanks in Advance
Sally
nullBrian Lelek (guest) wrote:
: Rashmi Rungta (guest) wrote:
: : Hi,
: : You cannot make a direct reference to a table name thru a
: : variable. You have to use dynamic sql.
: : Hope it helps. Let me know if you need further information on
: how
: : to use dynamic sql.
: : Rashmi
: : Sally (guest) wrote:
: : : I have the following procedure....
: : : LOOP
: : : FETCH table_cur INTO table_rec;
: : : EXIT WHEN NOT table_cur%FOUND;
: : : TableID := table_rec.TableName;
: : : Office := table_rec.OfficeNum;
: : : Client := table_rec.CliNum;
: : : IF Office = 'Y' AND Client = 'Y' Then
: : : UPDATE TableID
: : : SET OfficeNum = (SELECT OfficeNum
: : : FROM
: Comd02a
: : : WHERE Comd02a.CliNum =
: TableID.CliNum
: : : AND Comd02a.LoanNum =
: : TableID.LoanNum);
: : : END IF;
: : : END LOOP;
: : : CLOSE table_cur;
: : : TableID is a vaiable and I keep coming back with an
error...
: : How
: : : do I make a reference to a table through a variable...
: : : Thanks in Advance
: : : Sally
: The previous response is correct. You must use dynamic SQL.
: With dynamic SQL, you create a string in a varchar field that
: contains the SQL statement. Then you pass that string to
Oracle
: for execution. I think that orange and white book has a good
: explanation of dynamic SQL. My copy of the book is not here,
: but I can look it up in a few days if you are still having
: trouble.
: By the way, you may want to consider using a "cursor for
loop".
: This code is more simple because you don't need and OPEN,
FETCH,
: EXIT, or CLOSE. See below:
: FOR table_rec IN table_cur
: LOOP
: END LOOP;
: Brian
Hello,
Yes, you need to use dynamic SQL. If you are using oracle 7 or
8.0.x, you can use the bundled package dbms_sql to do the dynamic
SQL. If you are using 8i (8.1.5), the PL/SQL is improved to do
the dynamic SQL directly. You can now do for example:
begin
execute immediate 'update ' -
Table name where Broadcaster precalculation variables are saved
Please help me with the table name where Broadcaster precalculation variables are saved. Thanks.
Hello Jinal
Please go to transaction SE11 and there search in database table for tables starting with
/BIC/OB*
My table for example is named as following /it is the first precalculated value set:
Transparent table -> /BIC/OB00000001
description -> Calculate with Broadcast Setting Z_CCUSTOMER_PRECALC_01
However table class is L, where so I don't knwo how to see the data..
In case you know please let me know
Best regards
Christian -
Need to know schema name and table name associated with a column-URGENT
Hi folks,
I need to know the schema name and the table name associated with a column. Though jdbc has the api to getTableName and getSchemaName, some database vendor like oracle does return empty upon call of mentioned methods. I found that oracle driver does not support that
Can any one give me the solution? It is urgent. Or do you suggest any third pary jdbc driver which can provide those?
Thanks
AngelinaAngelina,
Your question has been discussed several times previously in this forum. Search this forum's archives for "getTableName". Oracle JDBC driver does not implement this (because "it is not feasible" -- according to Oracle).
First of all, I would suggest that you could probably change your application's logic so that you would not need this functionality (but I guess that is not feasible either, right :-)
Alternatively, you could try querying the Oracle database data dictionary.
Good Luck,
Avi. -
MTL Table name mapped with IC_ITEM_MST_B in oracle apps r12
Hi Experts,
Can anyone suggest me the MTL table name mapped with IC_ITEM_MST_B table in oracle apps with all the columns.
thanks,Response to: I don't see this option "Periodic Sequences in Format" under "Payment Instruction Format" table. I can see only Payment File Information.
You are maybe missing this (from Implementation Guide):
"Note: If no payment system is selected or entered for the Payment
System field in the Payment System subtab of the Update Payment
Process Profile page, then the Periodic Sequences in Format region is
not displayed."
The payment system must be selected at the time you create the profile. It does not seem to allow adding afterwards.
Edited by: user11974306 on Jan 25, 2013 1:49 PM
Edited by: user11974306 on Jan 25, 2013 1:49 PM -
Table name to find a variable used in which queries
Hello,
what is table name to find a particular variable used in which queries.write 'Variable Name:'.
write vname.
write /.
write 'Variable Type:'.
write variabletype.
write /.
write 'Based on Infoobject:'.
write variobj.
write /.
write 'Variable Processing Type:'.
write varprocesstyp.
write /.
write 'Variable Select Parameters:'.
write varselectiontyp.
write /.
write 'Variable Ready for Input:'.
write varinputtyp.
write /.
write 'Variable Entry criteria:'.
write varentrytyp.
write /.
write 'Variable can be changed during navigation:'.
write varchangeable.
write /.
* write
Select single varuniid from rszglobv into varid where vnam = p_varnm.
select single TXTLG from RSZELTTXT into variabledescription where ELTUID = varid and OBJVERS = 'A'.
write 'Variable Description:'.
write variabledescription.
write /.
write /.
querydet-querytechname = 'Query Technical Name'.
querydet-querydesc = 'Query Description'.
write querydet-querytechname.
write querydet-querydesc.
write /.
Select SELTUID from RSZELTXREF into table queryuid where TELTUID = varid and laytp = 'VAR' and OBJVERS = 'A'.
loop at queryuid into querydets.
select single compID from rszcompdir into querydet-querytechname where COMPUID = querydets-queryid and OBJVERS = 'A'.
select single txtlg from RSZELTTXT into querydet-querydesc where ELTUID = querydets-queryid and objvers = 'A'.
write querydet-querytechname.
write querydet-querydesc.
write /.
*update querydet from querydetail.
endloop.
write 'Query View Details for affected queries'.
write /.
viewtab-viewtechname = 'View Technical Name'.
viewdesc = 'View Description'.
write viewtab-viewtechname.
write viewdesc.
write /.
clear viewtab.
clear viewdesc.
loop at queryuid into querydets.
select single compID from rszcompdir into querydet-querytechname where COMPUID = querydets-queryid and OBJVERS = 'A'.
select viewid from rszwview into table viewtab where compid = querydet-querytechname and objvers = 'A'.
loop at viewtab into viewdetails.
select single TXTLG from RSZWOBJTXT into viewdesc where objid = viewdetails-viewtechname.
write viewdetails-viewtechname.
write viewdesc.
write /.
endloop.
endloop. -
ALL_TAB_COLUMNS table name showing with fancy characters
Dear All
when i execure followowing query and got a table name as BIN$eeHkLT/tL+PgRAAhKBTEWA==$0
select * from all_tab_columns
where column_name like '%APPLICATIONORDER%'
Please let me know what is this and how to select the data from it
thanking youits recycle bin ; please refer to oracle documentation to understand this feature;
see below from oracle documentaion : (http://www.oracle.com/technology/pub/articles/10gdba/week5_10gdba.html)
Managing the Recycle Bin
If the tables are not really dropped in this process--therefore not releasing the tablespace--what happens when the dropped objects take up all of that space?
The answer is simple: that situation does not even arise. When a tablespace is completely filled up with recycle bin data such that the datafiles have to extend to make room for more data, the tablespace is said to be under "space pressure." In that scenario, objects are automatically purged from the recycle bin in a first-in-first-out manner. The dependent objects (such as indexes) are removed before a table is removed.
Similarly, space pressure can occur with user quotas as defined for a particular tablespace. The tablespace may have enough free space, but the user may be running out of his or her allotted portion of it. In such situations, Oracle automatically purges objects belonging to that user in that tablespace.
In addition, there are several ways you can manually control the recycle bin. If you want to purge the specific table named TEST from the recycle bin after its drop, you could issue
PURGE TABLE TEST;
or using its recycle bin name:
PURGE TABLE "BIN$04LhcpndanfgMAAAAAANPw==$0";
This command will remove table TEST and all dependent objects such as indexes, constraints, and so on from the recycle bin, saving some space. If, however, you want to permanently drop an index from the recycle bin, you can do so using:
purge index in_test1_01;
which will remove the index only, leaving the copy of the table in the recycle bin.
Sometimes it might be useful to purge at a higher level. For instance, you may want to purge all the objects in recycle bin in a tablespace USERS. You would issue:
PURGE TABLESPACE USERS;
You may want to purge only the recycle bin for a particular user in that tablespace. This approach could come handy in data warehouse-type environments where users create and drop many transient tables. You could modify the command above to limit the purge to a specific user only:
PURGE TABLESPACE USERS USER SCOTT;
A user such as SCOTT would clear his own recycle bin with
PURGE RECYCLEBIN;
You as a DBA can purge all the objects in any tablespace using
PURGE DBA_RECYCLEBIN;
As you can see, the recycle bin can be managed in a variety of different ways to meet your specific needs. -
I want to create a PLSQL process that deletes rows from a table I identified by an item.
This does not work....throws the Error:
ORA-06550: line 4, column 29: PL/SQL: ORA-00903: invalid table name ORA-06550: line 4, column 1: PL/SQL: SQL Statement ignored
declare
begin
delete from staging.:P110_TABLE_NAME;
end;
What am I doing wrong here in the P110_TABLE_NAME substitution?
Edited by: user581839 on Dec 23, 2008 4:32 PMTry it this way
declare
begin
Execute immediate 'delete from staging.' || trim( :P110_TABLE_NAME);
end;Varad -
Table names for with holding tax
Hi all,
please can any body tellme few table names for withholding tax
thankshii...
you can use...
A399 Withholding tax code - country-specific
others are
/CCEE/FISISTGRD Reasons for Reversal enabling to change t
/CCEE/SIFICUSTPR Mapping table for customer procedure numb
A399 Withholding tax code - country-specific
BSIUDTT HR-US: BSI test data (tax record)
BTXEMPT BSI: Employee tax results
BTXERES BSI: Employee/Employer tax
CIMSYN Syntax Description for Extensions
COMC_R3_FIELDS Assignment of R/3 material master fields
CRMRDTRMSG Check Results Management: Texts of Messag
DFKKARREPCONTST ARGENTINA: Legal report sales tax control
EDISYN Syntax Description for Extended Basic Typ
EDSYN IDoc syntax after 3.0
ETXDCH External tax document: header info
ETXDCI External tax document: line item info
ETXDCJ Ext. tax document: tax rates and amounts
regards -
Table name ? with query name , variable name and variant .
Hi All,
Is there any single table with fields as query name , variable name and variant ?
or any table which i can build a view to get these fields.
or any other way ?? to get this fields in single table
Thanks,
AkHi,
first use the proper heading for a question.
you want the query all details means technical name, variable and variable type use RSRTQ
it will give total information of query.
Bex related tables
RSZELTDIR ----
Directory of the reporting component elements
RSZELTTXT ----
Texts of reporting component elements
RSZELTXREF ---
Directory of query element references .
Thanks,
Phani. -
LOV table column filter with bind variable
Greetings everyone,
I am using JDev version: 11.1.2.3.0
I have a table which has all it's columns with filterable property set to 'true'. I have already created a filter for the first one which displays the total list of users registered in the system. But the second one is a bit more complex.
I want to display a LOV which takes it's values from a VO with a bind variable. In a normal situation there is a another VO which links one of it's properties to this bind var in the View Accessor section of the LOV configuration dialog just like this:
http://2.bp.blogspot.com/_OSq71i5oy0c/SUa6qdnkkoI/AAAAAAAABnY/QnBPmGFgLI4/s400/3.PNG
But i want to be able to display this LOV in a column filter, the code i used is this:
<f:facet name="filter">
<af:selectOneChoice value="#{vs.filterCriteria.Debtor}"
label="Debtor" unselectedLabel=""
id="soc104">
<af:forEach items="#{bindings.ContractPartiesView1.rangeSet}"
var="debtors">
<f:selectItem id="si104"
itemLabel="#{debtors.Name}"
itemValue="#{debtors.PartyNumber}"/>
</af:forEach>
</af:selectOneChoice>
</f:facet>
Where Name is the name of the items to display, and PartyNumber is the value by which the table property (column) Debtor is connected to ContractPartiesView1 (the DC of the first VO).
It doesn't display nothing, and i suppose this is due the fact that ContractPartiesView1 has that bind variable which stays uninitialized.
I need to find a way to initialize this bind variable to get the filtered values for the LOV. I've tried to use a listOfValue binding insted of a tree, but with no result. Am i missing something?
Thanks in advanceI had resolved this, the very next day, but i didn't have chance to reply.
I've simply created another VO, which didn't have a bind variable to get that ID, it was simply linked with a master detail relationship with the one it should get the ID from (via FK). I've created this other VO because the first one was already in use for some other requirement. -
File name substitution with Data pump
Hi,
I'm experimenting with Oracle data pump export, 10.2 on Windows 2003 Server.
On my current export scripts, I am able to create the dump file name dynamically.
This name includes the database name, date, and time such as the
following : exp_testdb_01192005_1105.dmp.
When I try to do the same thing with data pump, it doesn't work. Has anyone
had success with this. Thanks.
ed lewisHi Ed
This is an example for your issue:
[oracle@dbservertest backups]$ expdp gsmtest/gsm directory=dpdir dumpfile=exp_testdb_01192005_1105.dmp tables=ban_banco
Export: Release 10.2.0.1.0 - Production on Thursday, 19 January, 2006 12:23:55
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "GSMTEST"."SYS_EXPORT_TABLE_01": gsmtest/******** directory=dpdir dumpfile=exp_testdb_01192005_1105.dmp tables=ban_banco
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/COMMENT
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "GSMTEST"."BAN_BANCO" 7.718 KB 9 rows
Master table "GSMTEST"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
Dump file set for GSMTEST.SYS_EXPORT_TABLE_01 is:
/megadata/clona/exp_testdb_01192005_1105.dmp
Job "GSMTEST"."SYS_EXPORT_TABLE_01" successfully completed at 12:24:18
This work OK.
Regards,
Wilson -
MySQL - In a Query, Using a Variable as a Table Name
Hello,
The code I have attached works. However, I would like to
replace the table name "tractors" with the variable "$result". How
do I do this? (It doesn't work if I just type "$result" where
"tractors" is.)
Thanks,
JohnArizonaJohn wrote:
> The code I have attached works. However, I would like to
replace the table
> name "tractors" with the variable "$result". How do I do
this?
You can't. In the code you have given $result is a MySQL
database result
resource. You need to extract the actual value from the
result resource
in the same way as you have done by using
mysql_fetch_array().
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS4",
"PHP Solutions" & "PHP Object-Oriented Solutions"
http://foundationphp.com/ -
Table names in generated stored procs are qualified with sa schema name
I am using OMW 9.2.0.1.2 with the 9.2.0.1.3 SQL Serevr plugin to help with a SQL Server 7 to Oracle 9.2.0.1 migration on NT.
As is common with SQL Server databases, the dbo is sa. I don't want my Oracle schema to be called sa. I have succesfully gotten around this by renaming the sa user in the Oracle model in OMW.
However, the stored procedure code that OMW generates has table names qualified with sa as the schema (the tables names in the original T/SQL procs were not qualified).
How can I stop OMW from generating table names qualified with sa?
Thanks.Hi,
this is a bug in the OMWB. As a workaround, you can generate the migration scripts (see reference guide and user guide for more information) from the OMWB Oracle Model and then edit these scripts to ensure that the 'sa' prefix does not appear in the text of the stored procedures. Then use these scripts to generate the schema in your database.
An alternative is to migrate the stored procedures, schema and data over to the Oracle database using OMWB and then open each procedure in Enterprise Manager, remove the references to the 'sa' prefix and re-compile the procedure.
I will keep you updated on the release this fix will appear in.
I hope this helps,
Tom. -
Read table, table name in variable
Hi all,
I am try trying to do the following.
Select statement to get the table name --> store in tname (variable).
Now, I have to do a select to read the data in this table (table name is in tname variable) based on some conditions
How do I do this?
1st step
Select ME_TECH from RSAC into tname
where NAME = 'PLANT'
and DATEFROM <= ldate
and DATETO >= ldate.
2nd step??
Thanks,
Anirudh.report ztest.
parameters: p_table type dd02l-tabname.
field-symbols: <fs> type standard table." of (p_table).
select * from (p_table)
into table <fs>
up to 20 rows.
There is another way using CL_ALV_TABLE_CREATE, for this you have to pass the fieldcatalog.
it return the internal table reference. using that you can proceed.
Maybe you are looking for
-
Using local interfaces for EJB (session bean)
Hi, I�ve a question regarding when to use the Local interfaces(EJBLocal and EJBLocalHome) of a enterprise bean. I understand that calls to enterprise bean can be made locally if the client which is invoking is in the same JVM as that of EJB. I�ve wri
-
Can I turn off Silent mode all together
When I go on call I find that out of force of habit (or just plain accident) I will put my phone on silent. Now this can be disasterous if I am callled by work for 24/7 support. I am looking for a way to do any of these: 1. Can disable the toggle on
-
Office 2010 Excel and InDesign CS2
For a number of years, I have been placing Excel tables and graphs into InDesign by turning them into PDFs. I was able to correctly size the tables/graphs by doing a "Copy as Picture" in Excel and directly pasting into InDesign prior to creating the
-
Issue updating to CS6. Extracts files and then nothing happens.
I went on the Adobe site, selected to update to CS6, downloaded the Akamai Downloader as requested, clicked download the bundle, the files extract, the window closes and then nothing happens.
-
Just purchased CS5.5 and it works fine however I am not able to activate it. The program says I don't have an internet connection but I clearly do I as I am able to connect to all websites & email etc... I have tried to contact customer support 6 tim