Oracle Dictionary: check what table belongs a column from a view
hi,
Is there any way to check in the oracle data dictionary what is the table that a column in a view belongs to?
Imagine this
create view xpto as
select table_a.col1, table_a.col2, table_b.column1
from table_a, table_b
I want to know that column1 in the view xpto belongs to the table_b.
Is this possible? How?
Best Regards,
Joao Oliveira
Hi Mat,
I know that I can check the table columns in that view or in user_Tab_columns. The problem is that some views have columns from different tables that have the same name. Understood?
So I really need to know what tables are part of the view query.
Thanks
Joao
Similar Messages
-
I can't import a table contains BLOB column from one user to another user.
1) I create two user both have connect role,and each has its own tablespace, DDL:
create user d2zd identified by d2zd default tablespace d2zd quota unlimited on d2zd account unlock;
grant connect to d2zd;
create user d3zd identified by d3zd default tablespace d3zd quota unlimited on d3zd account unlock;
grant connect to d3zd;
2)Then enter oracle as d2zd and create a table contains BLOB column and insert data to the table.
3) export d2zd as follow:
exp d2zd/d2zd file=d2zd.dmp
4) import to d3zd as follow:
imp d3zd/d3zd fromuser=d2zd touser=d3zd file=d2zd.dmp
the question is the table with BOLB colum can't be import,
it says:have no privilege on tablespace d2zd.
How can I import a table contains BLOB column from one user to another user?Hi - the reason for as our friend already told ist that a blob can be stored outside of the table segment, in another Tablespace, This is for performance reason.
Sou you would need to have Quota on two tablespaces.
the one which holds the table segment the other which holds the blob(segment).
Regards
Carl
Message was edited by:
kreitsch -
WF table overview is diff from applet view
Hi,
Here is the issue. When i checked my SC approval, it shows in Table view, Awaiting approval at 2nd level. Where as in applet view, it displays both 1st and 2nd levels as approved. How come i am getting 2 diff status?
I guess its a bug.. Did anyone come across this scenario?
Appreciate your inputs.
Thanks
KrishHi Imtiaz,
This note comes with SAPKIBK011 and we are already on this pack. But still we are getting tabular view diff from applet view.
Most of the time, table view happens to be correct..
Wondering why applet preview is not reflecting the current wf status.
Appreciate any inputs/clues.
Thanks
Krish -
How do I write an excel file and check what the next empty column would be to put the data in?
I have somehow managed to write the portion of labview that prompts the user for a name. It checks a file to see if they are a new user or not and then assigns a number if they are. The program then acquires data that is to be put into a spreadsheet. Each subject will have ten trials which will have three columns. How do I get the information into the columns and then check each time to see which column it should go into (i.e. the next empty column for that subject). I have attached what I have thus far. I wrote this a long time ago and haven't touched it for some time so everything is a blur.
Attachments:
promptForSwimmerName.vi 76 KB
Swimmers.dat 1 KB
Main__dummy.vi 28 KBTo perform those operations in excel you will use ActiveX. I will attach some examples of using Excel in LabVIEW and you can use these to do exactly what you want.
These three examples show how to manipulate properties, write to excel and read from excel. Let me know if there is more I can do.
Allan S.
Applications Engineering
National Instruments
Attachments:
BorderExample.vi 102 KB
ActiveX_write_Rows_To_Excel2000.vi 90 KB
ReadExample.vi 80 KB -
Check which table has no column with specific name over number of tables
Hello,
Withing my schema I have 66 tables, all of them have column last_update_date. Though not all have the column program_update_date. The problem is I want to go through all the tables and know which tables does not have the program_update_date column. It is to be noted that if the table does not have the program_update_date column query 2 will be used instead of query 1.
query1:
select last_extract_date,
to_char(min(greatest(nvl(*last_update_date*,'01-Jan-10'),nvl(*program_update_date*,'01-Jan-10'))),'DD-MON-YY HH24:MI:SS') mi,
to_char(max(greatest(nvl(*last_update_date*,'01-Jan-10'),nvl(*program_update_date*,'01-Jan-10'))),'DD-MON-YY HH24:MI:SS') ma
from table_names
group by last_extract_date
order by last_extract_date desc;
query2:
select last_extract_date,
to_char(min(nvl(last_update_date,'01-Jan-10')),'DD-MON-YY HH24:MI:SS') mi,
to_char(max(nvl(last_update_date,'01-Jan-10')),'DD-MON-YY HH24:MI:SS') ma
from mispa_events
group by last_extract_date
order by last_extract_date desc ;
Please find the PLSQL code that should be used:
Declare
cursor C_1 is
select unique table_name from user_tables; table_names varchar2(240); Begin Open C_1; Loop Fetch C_1 into table_names; EXIT WHEN C_1%NOTFOUND;
EXECUTE IMMEDIATE('select last_extract_date,
to_char(min(greatest(nvl(last_update_date,''01-Jan-10''),nvl(program_update_date,''01-Jan-10''))),''DD-MON-YY HH24:MI:SS'') mi,
to_char(max(greatest(nvl(last_update_date,''01-Jan-10''),nvl(program_update_date,''01-Jan-10''))),''DD-MON-YY HH24:MI:SS'') ma
from ' || table_names ||'
group by last_extract_date
order by last_extract_date desc');
End Loop;
Close C_1;
COMMIT;
End;
Please help.
Thanks in advance.
Edited by: P.Sam on Jun 14, 2010 5:00 PMwhy not use user_tab_columns
SQL> desc user_tab_columns
Name Null? Type
TABLE_NAME NOT NULL VARCHAR2(30)
COLUMN_NAME NOT NULL VARCHAR2(30)
DATA_TYPE VARCHAR2(106)
DATA_TYPE_MOD VARCHAR2(3)
DATA_TYPE_OWNER VARCHAR2(30)
DATA_LENGTH NOT NULL NUMBER
DATA_PRECISION NUMBER
DATA_SCALE NUMBER
NULLABLE VARCHAR2(1)
COLUMN_ID NUMBER
DEFAULT_LENGTH NUMBER
DATA_DEFAULT LONG
NUM_DISTINCT NUMBER
LOW_VALUE RAW(32)
HIGH_VALUE RAW(32)
DENSITY NUMBER
NUM_NULLS NUMBER
NUM_BUCKETS NUMBER
LAST_ANALYZED DATE
SAMPLE_SIZE NUMBER
CHARACTER_SET_NAME VARCHAR2(44)
CHAR_COL_DECL_LENGTH NUMBER
GLOBAL_STATS VARCHAR2(3)
USER_STATS VARCHAR2(3)
AVG_COL_LEN NUMBER
CHAR_LENGTH NUMBER
CHAR_USED VARCHAR2(1)
V80_FMT_IMAGE VARCHAR2(3)
DATA_UPGRADED VARCHAR2(3)
HISTOGRAM VARCHAR2(15) -
Migrating a table with BLOB column from one db to another
Hello everybody,
I have two databases D1 and D2. Each database contains table T1 (same structure in both databases). T has a BLOB column and is populated in D1. I have to move all the data from T database D1 into T database D2.
D1 and D2 are located on different machines. T in D1 is a huge table (milions of records). What is the best solution to migrate the T data between the 2 databases?
Any help will be appreciated.
Thank you in advance.
danielaDepending on the version of the database you have, you could use transportable tablespaces.
http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm#9370 -
Ability to query on all columns from a view with multiple tables
I have view with 4 tables. view has about 50 columns.
hypothetically, I want to build a form to give the user an ability to query on any of those 50 columns. user can search on one or more fields.
what is the best way to write the query to retrieve the results without performance impact.
please let me know if the question is not clear.If you want to permit them to query any of 10 fields with no restrictions, you could create 10 separate single-column indexes. The optimizer would have to try to pick the best of these indexes if you specified multiple search criteria. But since you have a view which presumably means that you've got multiple other indexes involved for the underlying join conditions, you'd probably want/need to combine the column lists of the indexes you're adding for searches with the indexes you've created for joins, which requires looking at the text of the view and figuring out the best way to optimize the 10 single-column searches. Of course, it is possible that the optimizer could chose to do something like a b-tree to bitmap conversion on multiple indexes which could allow it to use multiple independent indexes for your queries, but that's generally not ideal performance-wise.
All this is a fancy way of saying that there probably isn't a cut and dried answer to your question. You need to figure out the queries you're trying to optimize (say, the 10 single-condition queries) and you need to figure out what set of indexes on the various underlying tables provides the best performance weighing those benefits against the cost on other side of maintenance during DML. Which is going to depend on the text of the view, the underlying tables, the existing indexes, etc.
Justin -
Passing data to different internal tables with different columns from a comma delimited file
Hi,
I have a program wherein we upload a comma delimited file and based on the region( we have drop down in the selection screen to pick the region). Based on the region, the data from the file is passed to internal table. For region A, we have 10 columns and for region B we have 9 columns.
There is a split statement (split at comma) used to break the data into different columns.
I need to add hard error messages if the no. of columns in the uploaded file are incorrect. For example, if the uploaded file is of type region A, then the uploaded file should be split into 10 columns. If the file contains lesser or more columns thenan error message should be added. Similar is the case with region B.
I do not want to remove the existing split statement(existing code). Is there a way I can exactly pass the data into the internal table accurately? I have gone through some posts where in they have made use of the method cl_alv_table_create=>create_dynamic_table by passing the field catalog. But I cannot use this as I have two different internal tables to be populated based on the region. Appreciate help on this.
Thanks,
PavanHi Abhishek,
I have no issues with the rows. I have a file with format like a1,b1,c1,d1,e1, the file should be uploaded and split at comma. So far its fine. After this, if the file is related to region A say Asia, then it should have 5 fields( as an example). So, all the 5 values a1,b1..e1 will be passed to 5 fields of itab1.
I also have region B( say Europe) whose file will have only 4 fields. So, file is of the form a2,b2,c2,d2. Again data is split at comma and passed to itab2.
If some one loads file related to Asia and the file has only 4 fields then the data would be incorrect. Similar is the case when someone tries to load Europe file with 5 fields related data. To avoid this, I want to validate the data uploaded. For this, I want to count the no. of fields (seperated by comma). If no. of fields is 5 then the file is related to Asia or if no. of fields is 4 then it is Europe file.
Well, the no. of commas is nothing but no. of fields - 1. If the file is of the form a1,b1..e1 then I can say like if no. of commas = 4 then it is File Asia.But I am not sure how to write a code for this.Please advise.
Thanks,
Pavan -
Migrating CMP EJB mapped to SQL Server table with identity column from WL
Hi,
I want to migrate an application from Weblogic to SAP Netweaver 2004s (7.0). We had successfully migrated this application to an earlier version of Netweaver. I have a number of CMP EJBs which are mapped to SQL Server tables with the PK as identity columns(autogenerated by SQL Server). I am having difficulty mapping the same in persistant.xml. This scenario works perfectly well in Weblogic and worked by using ejb-pk in an earlier version of Netweaver.
Please let me know how to proceed.
-SekharI suspect it is the security as specified in the message. E.g .your DBA set the ID columns so no user can override values in it.
And I suggest you 1st put the data into a staging table, then push it to the destination, this does not resolve the issue, but ensures better processing.
Arthur
MyBlog
Twitter -
What table storing controlling area from C.Element, wbs group?
Hi All,
Greeting.
In my project right now, I need to bring over data Cost Element Group and WBS Group to BW.
In order to cater this, I fetch data up from setHeader and setLeaf tables.
My Question is how to get information about controlling area that belong to those object, because when I see org. unit field on the table (setHeader table), it's populated with different value with controlling area that I see on their t-code (KAH3 and KJH3).
Is that any table storing controlling area seen on t-code: KAH3 and KJH3 ?
Really need your help.
Thanks a lot and have a good day,
Best regards,
Daniel N.Hi Daniel,
It does not work this way. If you want to extract the controlling area of the obejcts you have to go to the relevant tables of the master data, e.g. for cost elements - CSKB, WBS - PRPS, etc.
Regards,
Eli -
Create a table which has columns from another table in other schema
Hi All
I need to create a table which is table driven i.e., the columns of that table need to be inserted from another table in a different schema...Can any one help me with this??create table newtab (--column spec here--) as
Select --columns here-- from otherschema.tablename;max -
Insert into a table with unique columns from another table.
There are two tables,
STG_DATA
ORDER_NO DIR_CUST_IND
1002 DNA
1005 GEN
1005
1008 NULL
1001 NULL
1001 NULL
1006 NULL
1000 ZZZ
1001 ZZZ
FACT_DATA
ORDER_NO DIR_CUST_IND
1005 NULL
1006 NULL
1008 NULL
I need to insert only unique [ORDER_NO] from STG_DATA to FACT_DATA with corresponding [DIR_CUST_IND]. Though STG_DATA has multiple rows with same ORDER_NO, I need to insert only one of that it can be any record.
SarvanCREATE TABLE #Level(ORDER_NO INT, DIR_CUST_IND CHAR(3))
INSERT #Level
SELECT 1002,'DNA' UNION
SELECT 1005,'GEN' UNION
SELECT 1005,NULL UNION
SELECT 1008,NULL UNION
SELECT 1001,NULL UNION
SELECT 1001,NULL UNION
SELECT 1006,NULL UNION
SELECT 1000,'ZZZ' UNION
SELECT 1001,'ZZZ'
SELECT ORDER_NO,DIR_CUST_IND
FROM( SELECT ROW_NUMBER()OVER(PARTITION BY ORDER_NO ORDER BY ORDER_NO) RowNum,*
FROM #Level)A
WHERE RowNum=1
I hope this would give you enough idea. All you have to do is just write insert statement.
Next time please post DDL & DML.
Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
The climb is all there is. -
How can I display the descriptor column from a view in my BR message
I have a table, Memberships, that contains a column for staff id. The staff data is on a remote database and I have created a view to access the required data. I have set the descriptor sequence for the name column of the staff view but the BR still displays the id.
I'm assuming that because staff is a view and has no capi of its own, the membership capi cannot call the staff capi function display_label.
I still would like to display the name of the staff member instaid of the ID. Can anyone suggest a workaround to force the display but without having to customize the membership capi after it has been created by headstart?Hi,
try altering the code to create the capi.
I modified this code allready quite a lot to achieve my goals.
I also had that problem, and solved it by altering the code that generates the display_label. For each display_label funtion, I add a call to a package- function 'APPPA_LABEL.display_label' with parameters the tablename and the pk of the record. In the packagefunction, you can write your own definition of the display-label.
The Productivity Boosters look a bit difficult in the beginning, but when you get to know them, you can achieve some good results.
Greetings,
Kristof -
Generate insert statement using columns from all_tab_cols view
i am trying to generate a dynamic insert statement using the columns for a table from the all_tab_cols view. if i do a select, i get the output as rows. How do i convert the row out to columns so that i get something like this : INSERT INTO TABLE_NAME (COL1, COL2, COL3,COL4.....) .
Any help will be appreciated!SQL> select * from my_test;
no rows selected
SQL> desc my_Test;
Name Null? Type
COL1 NUMBER
COL2 NUMBER
COL3 NUMBER
SQL> declare
2 cursor c1 is select column_name from all_tab_cols where table_name = 'MY_TEST';
3 v_sql VARCHAR2(10000) := NULL;
4 v_cnt NUMBER := 0;
5 BEGIN
6 FOR I in C1 LOOP
7 v_cnt := v_cnt + 1;
8 v_sql := 'INSERT INTO my_test('||I.column_name||') values('||v_cnt||')';
9 EXECUTE IMMEDIATE v_sql;
10 END LOOP;
11 COMMIT;
12 end;
13 /
PL/SQL procedure successfully completed.
SQL> select * from my_Test;
COL1 COL2 COL3
1
2
3
SQL> -
Hiding a column from materialized view
Hello All,
I have created a materialized view which aggregates the monthly wise data, as we know, for refresh on commit of this view i have selected count(*) and count(col).
My problem is i don't want these columns to appear in the materialized view.
regardsIf you include the columns in the select statement that generates the materialized view they will be visible. So your choices are:
(1) don't include them in the query
(2) overley the materialized view with a plain view.
Apparently you don't like option 2, which leaves option 1. I must confess I don't understand your original post, so maybe you could explain in more depth why you have these columns you don't want. There may be some other way of achieving your aim.
Cheers, APC
Maybe you are looking for
-
Ipod claims to have synced but didnt transfer songs to ipod
i will connect to itunes and it will go through all four syncing steps but once i eject it the songs that show up on itunes do not show up on my actual ipod . and the purchased playlist shows up on my ipod but not on itunes . so theres something wron
-
My credit card was charged, but I'd made no purchase
Hello, I had to change my Apple ID e-mail to a new one I'd created earlier today. Everything was okay until I logged into Games Center and found out my Phone had logged me in through a very old Apple ID I'd deleted ages ago. So, I switched my account
-
XLS Files created by SSRS will not open in Numbers on the iPad
The company I work for creates business intelligence reports which are used in an education environment and are created daily and e-mailed out to staff. These reports contain fairly simple tables with pupil data. One customer uses iPads extensively
-
Two days ago my computer died and I haven't been able to get past the Apple screen since. I've tried starting in Safe mode, etc. that did not work. I just started up using my installation disk and got into Disk Utility. It says it cannot repair the d
-
Video Doesn't Work...Why?
I keep getting "there was a communications error in your chat" Here is the first half of the error message... Date/Time: 2008-12-19 21:28:12.428 -0500 OS Version: 10.5.6 (Build 9G55) Report Version: 4 iChat Connection Log: 2008-12-19 21:27:34 -0500: