Get the table names from a specified schema name
Can't any one can hlep me how to use OCIDescribeAny() to retrive the list of table names for a given schema name?
I have problem when I connect to the database using syste as usr id. I can't ge the table name form the SCOTT schema.
If I understand you correctly, I don't think OCIDescribeAny() is the way to go.
You can get a list of tables owned by a particular schema by using the following SQL:-
SELECT TABLE_NAME FROM DBA_TABLES WHERE OWNER = 'SCOTT'
Just change the where clause to your needs.
Regards.
Adrian
Similar Messages
-
Is it possible to view/get the table data from a dump file
I have dmp files generated using expdp on oracle 11g..
expdp_schemas_18MAY2013_1.dmp
expdp_schemas_18MAY2013_2.dmp
expdp_schemas_18MAY2013_3.dmp
Can I use a parameter file given below to get the table data in to the sql file or impdp the only option to load the table data in to database.
vi test1.par
USERID="/ as sysdba"
DIRECTORY=DATA
dumpfile=expdp_schemas_18MAY2013%S.dmp
SCHEMAS=USER1,USER2
LOGFILE=user_dump_data.log
SQLFILE=user_dump_data.sql
and impdp parfile=test1.par.Hi,
To explain more about my situation.
Target database has the dump files, where as the source database (cloud) doesn't have access to the target database.
However, I can request the target DB DBA team to run the par files and provide me the output like a SQL file which I can take and run it in my source database.
I got the metadata the same way, but is there any way I could get the data from the dump files on the target DB without actually accessing it? My question might sound weird, but please let me know.
<
1. export from the source into a dumpfile. You can do this on the source database and then copy the file over to your local database or you can do this from a local database if you have a database link defined on the local database that points to the source database. In the second case, your dumpfile will be created on your local database.
>
How can i access the dump using the database link? -
How to get the table with no. of records after filter in webdynpro
Dear Gurus,
How to get the table with no. of records after filter in webdynpro?
Thanks in advance.
SankarHello Sankar,
Please explain your requirement clearly so that we can help you easily.
To get the table records from your context node use method get_static_attributes_table()
data lo_nd_mynode type ref to if_wd_context_node.
data lt_atrributes_table type wd_this->elements_mynode.
lo_nd_mynode = wd_context->get_child_node( name = wd_this->wdctx_mynode ).
lo_nd_mynode->get_static_attributes_table( importing table = lt_atrributes_table ).
Note: You should have already defined your context node as a Dictionary Structure.
BR,
RAM -
How to get the table name and bind columns names in an INSERT statement ?
I have an INSERT statement with input parameters (for example
INSERT INTO my_table VALUES (:a, :a, :a)) and I want to know
without parsing the statement which is the name of table to
insert to and the corresponding columns.
This is needed to generate the SELECT FOR UPDATE statement to
refetch a BLOB before actually writing to it. The code does not
know in advance the schema (generic code).
Thanks in advance,
Joseph CanedoOnce you have prepared your statement, you can execute the
statement with the OCI_DESCRIBE_ONLY mode before binding any
columns. Then you can use OCIParamGet to find out about each
column (column index is 1-based). You should get OCI_NO_DATA or
ORA-24334 if there are no more columns in the statement. Note
that the parameter descriptor from OCIParamGet is
allocated/freed internally by OCI; you do not need to manage it
explicitly. The parameter descriptor is passed to OCIAttrGet in
order to obtain for instance the maximum size of data in the
column OCI_ATTR_DATA_SIZE. You can also get the column name in
this way, although I do not remember the #define off the top of
my head. Getting the table name appears to be much more
difficult; I have never had to do that yet. Good luck. -Ralph -
How to get the table name in the trigger definition without hard coding.
CREATE TRIGGER db.mytablename
AFTER UPDATE,INSERT
AS
INSERT INTO table1(col1)
SELECT InsRec.col1
FROM
INSERTED Ins
--Below i am calling one sp for which i have to pass the table name
EXEC myspname 'tablename'
In the above trigger,presently i am hard coding the tablename
but is it possible to get the table name dynamically on which the trigger is defined in order to avoid hard coding the table nameI really liked your audit table concept. You inspired me to modify it so that, the entire recordset gets captured and added a couple of other fields. Wanted to share my end result.
USE [YourDB]
GO
/****** Object: Trigger [dbo].[iudt_AutoAuditChanges] Script Date: 10/18/2013 12:49:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[iudt_AutoAuditChanges]
ON [dbo].[YourTable]
AFTER INSERT,DELETE,UPDATE
AS
BEGIN
SET NOCOUNT ON;
Declare @v_AuditID bigint
IF OBJECT_ID('dbo.AutoAudit','U') IS NULL BEGIN
CREATE TABLE [dbo].[AutoAudit]
( [AuditID] bigint identity,
[AuditDate] DateTime,
[AuditUserName] varchar(128),
[TableName] varchar(128) NULL,
[OldContent] XML NULL,
[NewContent] XML NULL
ALTER TABLE dbo.AutoAudit ADD CONSTRAINT
PK_AutoAudit PRIMARY KEY CLUSTERED
[AuditID]
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
CREATE NONCLUSTERED INDEX [idx_AutoAudit_TableName_AuditDate] ON [dbo].[AutoAudit]
( [TableName] ASC,
[AuditDate] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
END
Select * Into #AuditDeleted from deleted
Select * Into #AuditInserted from inserted
While (Select COUNT(*) from #AuditDeleted) > 0 OR (Select COUNT(*) from #AuditInserted) > 0
Begin
INSERT INTO [dbo].[AutoAudit]
( [AuditDate], [AuditUserName], [TableName], [OldContent], [NewContent])
SELECT
GETDATE(),
SUSER_NAME(),
[TableName]=object_name([parent_obj]),
[OldContent]=CAST((SELECT TOP 1 * FROM #AuditDeleted D FOR XML RAW) AS XML),
[NewContent]=CAST((SELECT TOP 1 * FROM #AuditInserted I FOR XML RAW) AS XML)
FROM sysobjects
WHERE
[xtype] = 'tr'
and [name] = OBJECT_NAME(@@PROCID)
Set @v_AuditID = SCOPE_IDENTITY()
Delete from AutoAudit
Where AuditID = @v_AuditID
AND Convert(varchar(max),oldContent) = Convert(varchar(max),NewContent)
Delete top(1) from #AuditDeleted
Delete top(1) from #AuditInserted
End
END -
How to get the insert scripts from a table data
hi all,
i want insert scripts for 100 records from a table.
suppose i have a table xyz
xyz:
id name
1 abc
2 def
i should get insert script for 100 rows like
insert into xyz(id,name) values (1,'abc');
insert into xyz(id,name) values (2,'def');
i want 100 records data from all the tables from my database.
thanks in advance to all.SQL> create table xyz (id number, name varchar2(10));
Table created.
SQL> insert into xyz values(1,'abc');
1 row created.
SQL> insert into xyz values(2,'def');
1 row created.
SQL> select 'insert into xyz values(id,name) values('||id||','''||name||''');' from xyz;
'INSERTINTOXYZVALUES(ID,NAM
insert into xyz values(id,name) values(1,'abc');
insert into xyz values(id,name) values(2,'def');
SQL>- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/] -
How to get the table name of a field in a result set
hi!
i have a simple sql query as
select tbl_customerRegistration.*, tbl_customerAddress.address from tbl_customerRegistration, tbl_customerAddress where tbl_customerAddress.customer_id = tbl_customerRegistration.customer_ID
this query executes well and gets data from the database when i get ResultsetMetaData from my result set (having result of above query) i am able to get the field name as
ResultSetMetaData rsmd = rs.getMetaData();//rs is result set
String columnName = rsmd.getColumnName(1);
here i get columnName = "Customer_id"
but when i try to get the tabel name from meta data as
String tableName = rsmd.getTableName(1); i get empty string in table name....
i want to get the table name of the respective field here as it is very important to my logic.....
how can i do that.....
please help me in that regard as it is very urgent
thanks in advance
sajjad ahmed paracha
you may also see the discussion on following link
http://forum.java.sun.com/thread.jspa?threadID=610200&tstart=0So far as I'm aware, you can't get metadata information about the underlying tables in a query from Oracle and/or the Oracle drivers. I suspect, in fact, that the driver would have to have its own SQL parser to get this sort of information.
I'm curious though-- how do you have application logic that depends on the name of the source table but not know in the application what table is involved? Could you do something "cheesy" like
SELECT 'tbl_customerRegistration' AS tbl1_name,
tbl_customerRegistration.*
...Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How do I get the table of contents to toggle? It has remained open since I opened it while reading two books ago. Thanks for the help.
Thank you for your advice. I followed your directions, but came up with the same results. However, I did discover that whenever I open up the iPhoto Library that is already existing on my MacBook a certain set of pictures shows up. But then when I open up the iPhoto Library from the Hard drive another set of pictures shows up. BUT not ALL of my pictures are showing up on the iPhoto Library from the hard drive. At least the last two years of pictures are not showing up?! Actually, it appears that all the pictures are there from when I started using iPhoto about 5 years ago up until around the time that I got my iMac desktop computer and started using that (2 years ago). I have noticed that more recent videos I have made are showing up in a folder on the hard drive, but will not appear when I open up iMovie?! Any ideas on how to access my pictures from the last 2 years off of the hard drive???
-
How to get the long file name from an 8.3 name in Windows.
Because of a legacy string limitation, I have a list of files in 8.3 format. The actual files are saved with long names. How can I get the long name from the short name?
In JavaScript, I would get a file system object and get the file object from there with the short name. Then it's no problem to get the full name. But I don't see anything in Java that matches that. ???
Ideas?
Frank Perry, MSEEHere is what I did.
String displayName = "somefi~1.txt";
File fO = new File("c:\\"); // I have a more involved path but that's not important here.
String stPath = fO.getPath() + displayName;
File fD = new File(stPath); // get the file using the short name.
File fDc = new File(fD.getCanonicalPath()); // get another file using the cononical name
String FulldisplayName = fDc.getName(); // get the long name from there.
It's roundabout but it works. Since getName() on the file read with the short name only returns the name used to get the file, I open it twice. The alternative is to parse the cononical name for the file name but that's clumbsy too.
Frank -
We are upgrading from 8.3 to 9.2. How can i get the table(record) structure changes between these 2 versions. I am not able to find it in Oracle support.
My guess is you want to upgrade HR8.3 to 9.2 - and that is not one jump upgrade. You will need to go HRMS 83 to 90
(PeopleSoft Enterprise HRMS 8.3x to 9.0 Upgrade (Doc ID 747333.1) and then 90 to 92 (PeopleSoft Human Capital Management 9.0 to 9.2 Upgrade Home Page (Doc ID 1536087.1)
Each these MOS pages contains the Demo to Demo Compare Reports that show the data structures changes between the releases.
Hope it helps. -
How can I get the remote directory from an FTPActivationSpec header?
The header message generated for the oracle.tip.adapter.ftp.inbound.FTPActivationSpec contains the file name, FTP host and FTP port. Is there any way of getting the remote directory as well?
<schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/ftp/"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:FTPAPP="http://xmlns.oracle.com/pcbpel/adapter/ftp/">
<element name="InboundFTPHeaderType">
<complexType>
<sequence>
<element name="fileName" type="string"/>
<element name="ftpHost" type="string"/>
<element name="ftpPort" type="string"/>
</sequence>
</complexType>
</element>
</schema>
This is already specified in the activation spec parameters:
<activationAgents>
<activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="ReadFileService">
<property name="ftpRemoteDir" type="LogicalDirectory">out</property>
<property name="portType">Read_ptt</property>
</activationAgent>
</activationAgents>
But I don't want to have to add a separate preference parameter to hold the same thing if I don't have to. Alternatively, is there any way of querying the activation agent parameters from within an xpath expression, similar to "ora:getPreference()"?
Cheers,add:
<element name="directory" type="string"/>
to the FTP adapter header WSDL -
Is there a way to get the correct order from the dependent types of a sche
Hi ,
I have a CT facing the following problem:
When trying to built a SQL script to create all the object types within a schema using the DBMS_METADATA packages.
Did insert in a table the names of the types that will be exported following a concrete order, next loop into the table and call the DBMS_METADATA package for each row.
These type are depedent between them, there are some type attributes calling other types and here the issue
First : try to generate the order by created column of dba_objects and when the generated SQL script is launched a lot of type appearing as incomplete state due to the order isn't correct.
Second : try to insert the table ordering by object_id colums of dba_tables view, it appears incomplete types too.
Currently want to insert the table using a recursive query with connect by against the dba_type_attrs starting with the rows when ATTR_TYPE_NAME is not null (the types that are called by other types), but this way has a issue dificult to resolve: the roots of hierarchy are the rows when ATTR_TYPE_NAME is not null and we've dependencies between roots nodes
The question is is there a way to get the correct order from the dependent types of a schema?
Platform: IBM SP AIX
DB version: 9.2.0.7
Any help will be appreciated .
Thanks in advance.The xxx_dependencies view should give you the dependencies betwee nthe various types. I would look at something along the lines of:
SELECT object_name, referenced_name
FROM (SELECT o.object_name, d.referenced_name
FROM user_objects o, user_dependencies d
WHERE o.object_name = d.name(+) and
o.object_type = d.type(+) and
d.referenced_type(+) = 'TYPE' and
o.object_type = 'TYPE')
START WITH referenced_name IS NULL
CONNECT BY PRIOR object_name = referenced_nameThe outer join between user_objects and user_dependencies is required to generate the names of types which are not dependent on other types, or do not have other types dependent on them.
HTH
John -
Specify schema name in select statements
Is there a way to specify the schema name for the connection so that I don't have to specify schema name with every statement?
Currently I am executing the statement:
Statement stmt = null;
ResultSet rs = null;
String getAllNames =
"SELECT NAME FROM " + schemaName +".NAMES " + schemaName +" WHERE STATUS_CODE != 12 ";
stmt = conn.createStatement();
rs = stmt.executeQuery(getAllNames);
But I have a lot of such statements, a few which uses parameters.
Is there a way I can specify the schemaName once and for all so that I don't have to perform string concat everytime the function is invoked.well I tried that, since the application runs under CICS which uses the trusted connection with DB2, all CICS application will be using the same userid and there is no way to ensure that other applications would not be using the same table name in some other application. So the only option I have is to specify the schema name with the select statements but I don't want to append the schema name with each statement.
-
Problem in getting the database connection from a connection pool
Hai All,
I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
I am using the Oracle database 8.1.7.
I have configured my connection pool, datasource and JNDI in weblogic.
In my java program i have the following code to retrieve the connection.
import java.sql.*;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
class jdbcshp1 {
public static void main(String[] args) {
Connection connection = null;
try {
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); // Wanna get rid of this.
ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
// Get a context for the JNDI look up
Context ctx = new InitialContext(ht);
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
//Create a connection object
connection = ds.getConnection();
The above code is working fine but, the two ht.put statements are creating problem.
The problem is, after converting the application into WAR file it can be deployed
on any machine or different port on same machine. My application fails if its deployed on
weglogicserver which is at different port.
Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
any help is appreciated.
Thanks in advance
Pooja.Hai All,
Firstly, thanks for ur reply.
Even i have seen some code which uses context constructor with out any parameter and works fine.
i dont understand why its not working for my code.
When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
Context ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
connection = ds.getConnection();The error is as follows:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
I appreciate all ur valuable help.
Thanks once again.
Pooja. -
Were I can get the table of PIKMG
Dear Guru,
I want to no from which table I can get the data of Pick Qty.
When I go to VL02N Pick Qty, their I can find
Structure : - LIPSD
Feild : - PIKMG.
But when I am searching in PIKGM I am not getting any data.
So, will u help me to get the table name of PIKMG.
Manoj Kumargo to tcode: se 11
enter the name: LIPS (delivery: item data)
click on display
you can see the field name: LGMNG (actual qty del in stock keeping units)
Maybe you are looking for
-
My I message is working with everyone BUT with one phone, Same thong happen with this other phone i message works with everyone else but with me What did i did?
-
I am thinking of changing from a PC to a Mac. Will I need to buy a new, Apple compatible, version of Lightroom, or can I upgrade to it, or can I get it free as I've paid for the PC version?
-
I homeschool and want to show PDFs and websites from my ipad to the tv, using the tv like a projector. How do I do this?
-
Using Dimensions with SQL Developer 3.1
After much effort I have been able to install the Dimensions plug-in to SQL Developer. I had to take a round about way due to proxy issues and manually installed it. Manually copied the zip file and extracted under jdev/extensions. But now I am havin
-
Hi, In a Java Servlet, I need to convert HTML codes into an RTF/word document. Any help for some related Java API ? Regards, Priya Ranjan Sahay Message was edited by: Priya Ranjan Sahay