Create a view in the database based off a jdbc connection
I have some data in a DB2 database that I would like to union with a table in an Oracle Database in the Oracle Database.
Can I create a jdbc connection in the Oracle database that points to the DB2 database and then create a view based off of the jdbc connection?
I've never done anything like this , but if this a no brainer please just post a link or something that points me in the right direction thanks...
I've searched...
Mark,
I was going to suggest the same thing as Jan did when she answered this question that you also posted to the Union DB2 and Oracle data in a view and display in a form using jdbc? forum.
Good Luck,
Avi.
Similar Messages
-
Include or create a view in the database and use this view?
Well, I need to get related data of the main table from another related tables, so one way to do that is to use the Include method in Entity Framework to get this related data.
However, I am thinking in another option, create a view in the database and use this view in entity framework. In this way, I avoid the needed of the include, because I think that is expensive in resources. But I am no very sure about that.
I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
For example, if I use the include I have the advantage that I get only one the main record and all the related data I have in the navigation properties, so the info is more shorted.
Which is the advanteges and disadvantages of both methods to get related data in entity framework?
Thank so much.Hello ComptonAlvaro,
>>I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
If your view would use a Join syntax to query master-child relationship tables, it actually is similar with the Include() method which actually results a duplicate records from master table, you could check this
link for detail description.
>>Which is the advanteges and disadvantages of both methods to get related data in entity framework?
One visible difference is that records from Views are not editable by default(if you want edit them, you could refer to this
blog).
In your case, my suggestion that you could use the lazying load which will load the matter table once and disable the trace if you only need to display data.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Error while creating materialized view which using database link
Helo!
I'm getting error "ORA-00942: table or view does not exist" when I want to create materialized view.
Details:
1. On destination database I create a database link:
CREATE DATABASE LINK SDATABASE
CONNECT TO MYUSER
IDENTIFIED BY MYUSERPASS
USING 'ORCL';
=> Command "SELECT * FROM TABLE1@SDATABASE" returns data normally!
2. On source database I create MATERIALIZED VIEW LOG:
CREATE MATERIALIZED VIEW LOG
ON TABLE1
WITH PRIMARY KEY
INCLUDING NEW VALUES;
3. Now, when I want to create MATERIALIZED VIEW on destination database:
CREATE MATERIALIZED VIEW TABLE1
REFRESH FAST
START WITH SYSDATE
NEXT SYSDATE + 1/1440
WITH PRIMARY KEY
AS SELECT * FROM TABLE1@SDATABASE;
...I get error "ORA-00942: table or view does not exist"!
How is that possible if command "SELECT * FROM TABLE1@SDATABASE" returns data normally?
Thanks,
VorancAnd, I'm using Oracle 10g.
Voranc -
Can we create materialized view on the top of another materialized view.
Hi ,
can we create materialized view on the top of another materialized view.
Thanks
NaveenWelcome , Just remember is not good apporch to do that since performance when MV refresh
Please mark this thread as answered . -
Creating Materialized View with the Distinct key word
Hi
I need help to create Materialized View with the Distinct key word.
my query is
select distinct col1, col2 from t1;
is there any alternate of DISTINCT because I can not refresh the MV as fast on demand if I am using it and Fast on Demand is a must for me.hi
check out this link
http://download-west.oracle.com/docs/cd/B12037_01/server.101/b10736/basicmv.htm#i1007299
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/intro.htm#sthref183
hope this helps
CHeers -
Creating filtered view on the physical layer ussing session variable USER
Hi:
I´m creating a view on the physical layer, the view needs to be created dynamically. So depending on the user (using the session variable USER) the view is created with the data a particular user is able to see.
Fisrt I imported the table and changed it´s properties to be created through a "Select Statement" so i don´t needed to change the mapping on the bussiness model layer.
The consistency check was OK but i´m not able to see data in answers, even using the Administrator user. Have anyone tried to do this? Here is my query.
Thanks
A Garcia
Select * from D_ESTRUCTURA_RH2 where Region_ID
IN
select distinct a.REGION_ID from APP_INDPERSONAL_DM.D_ESTRUCTURA_RH2 a
inner join (
select distinct b.REGION_ID from APP_INDPERSONAL_DM.D_ESTRUCTURA_RH2 b
where exists (select 1 from APP_INDPERSONAL_DM.Autorizacion a, usuarios c
where a.app_id = 1
and a.usuario_id = c.Usuario_Id
and UPPER(c.Nombre_Usuario)=UPPER(':USER')
and a.miembro_id = 'REGION_ID'
and a.operador = '='
and (b.REGION_ID = (case when valor = 'Todo' then 0 else valor end) or valor='Todo'))
) seguridad
on
a. REGION_ID = seguridad.REGION_ID
)whay not use the same filter in the content tab of the logical table source?
check the physical sql sent to databse using web-admin-manage sessions-view log and see if there is any unexpected behavior. also run the same query in db and see iff you get the results in databse itself. -
OBIEE 11G - The database Weblogic is trying to connect to is refusing the connection.
Hi,
The database Weblogic is trying to connect to is refusing the connection, per my error messages. Which file will have the JDBC connection information?
Thanks for your time and help.Can u paste the error log messages?
-
Turn Autocommit off for JDBC Connection
I'd like to control the commit for DBMS_XMLSave operations on my own instead of auto commit. The documentation says to "Turn Autocommit off for JDBC Connection", but I haven't found how to do that yet, any clues?
My apologies for how complicated this is, it was written to be a
generic xml processor for multiple tables. I narrowed it to one
table. It converts a long to clob, parses it, walks the dom to
find rows and processes each row. One InsertXML per row in the
XML.
CREATE OR REPLACE package whl_rtl_xml_pkg as
--Context definitions by table
HUDLINE_CTX_IND char(1) := 'N';
HUDLINE_Ctx DBMS_XMLSave.ctxType := null;
procedure accept_xml (in_long in long, out_sts out char, out_msg
out varchar2);
procedure updt_hudline(in_row_node in xmldom.DOMNode, in_clob
clob, out_sts out char, out_msg out varchar2);
procedure set_context(in_table_name in varchar2, out_sts out
char, out_msg out varchar2);
end whl_rtl_xml_pkg;
CREATE OR REPLACE package body whl_rtl_xml_pkg as
procedure accept_xml (in_long in long, out_sts out char, out_msg
out varchar2) is
begin
declare
-- Long to CLOB and Parse XML variables
v_in_clob clob; -- Entire long converted to clob
v_clob clob; -- One row written to clob from DOM
doc xmldom.domdocument; -- Parsed XML Document
v_long_lnth NUMBER;
v_nbr INTEGER := 500;
bbuf varchar2(500);
p xmlparser.parser;
retval xmldom.domdocument;
--LOANLOCK information
lock_list xmldom.DOMNodeList;
lock_node xmldom.DOMNODE;
lock_loan_nbr WHL_LOAN_TB.LOAN_NBR%TYPE;
lock_rcd_updt_ts WHL_LOAN_TB.RCD_UPDT_TS%TYPE;
lock_rcd_updt_user_id WHL_LOAN_TB.RCD_UPDT_USER_ID%TYPE;
V_RETURN char(2);
-- Rowset Info
rowset_nl xmldom.DOMNodeList;
rowset_len number;
rowset_node xmldom.DOMNode;
rowset_table varchar2(30);
-- Row Info
row_nl xmldom.DOMNodeList;
row_len number;
row_node xmldom.DOMNode;
-- General
v_table_name char(30);
v_time char(10);
v_ret_sts char(2);
v_ret_msg VARCHAR2(200);
function selected_nodes (in_xpath varchar2)
return xmldom.domnodelist is
retval xmldom.domnodelist;
begin
retval := xslprocessor.selectnodes (xmldom.makenode
(doc),in_xpath);
RETURN retval;
end selected_nodes;
begin
--Connection.setAutoCommit(false);
v_long_lnth := length(in_long); -- Determine length of XML Input
-- Create Clob and convert long to CLOB
dbms_lob.createtemporary(v_in_clob,TRUE);
dbms_lob.createtemporary(v_clob,TRUE);
dbms_lob.write(v_in_clob,v_long_lnth,1,in_long);
-- Parse Clob, create DOM
p := xmlparser.newParser;
xmlparser.parseCLOB(p,v_in_clob);
doc := xmlparser.getDocument(p);
-- Loop through ROWSETS
rowset_nl := selected_nodes('/ROOT/ROWSET'); -- Find rowset
nodes
rowset_len := xmldom.getLength(rowset_nl);
for rs in 0..rowset_len-1 loop
rowset_node := xmldom.item(rowset_nl,rs);
rowset_table := xslprocessor.valueof
(rowset_node,'TABLE_NAME'); -- Determine which table the rowset
is for
-- set up context for this table
set_context(rtrim(rowset_table), v_ret_sts, v_ret_msg);
IF V_RET_STS != '00' THEN -- Update failed for row
OUT_STS := '01';
OUT_MSG:= 'WHL_RTL_TEMPLATE_SP ERROR from:'||rtrim
(v_ret_msg);
RETURN;
END IF;
-- Loop through Row Nodes to process individual rows
row_nl := xslprocessor.selectnodes (rowset_node,'ROW');
row_len := xmldom.getLength(row_nl);
for i in 0..row_len-1 loop
row_node := xmldom.item(row_nl,i);
xmldom.writeToClob(row_node, v_clob);
-- DBMS_LOB.READ (v_clob, v_nbr, 1, Bbuf);
-- dbms_output.put_line(substr(bbuf,1,200));
-- Find elements of "ROW" -->Column Names needed for key
processing
-- call function to process row for the table
-- pulls column names needed and update row in database
as required
if rowset_table = 'WHL_HUDLINE_TB' then
updt_hudline(row_node, v_clob, v_ret_sts, v_ret_msg);
IF V_RET_STS != '00' THEN -- Update failed for
row
OUT_STS := '01';
OUT_MSG:= 'WHL_RTL_TEMPLATE_SP ERROR from:'||rtrim
(v_ret_msg);
RETURN;
END IF;
end if;
end loop;
end loop;
-- Clean up
dbms_lob.FREETEMPORARY (v_in_clob);
dbms_lob.FREETEMPORARY (v_clob);
out_sts := '00';
out_msg := 'WHL_RTL_XML_PKG.ACCEPT_XML Finished without errors';
exception
when others then
out_sts := '99';
out_msg := 'WHL_RTL_XML_PKG uncaught error:'|| SQLERRM;
end;
end accept_xml;
procedure updt_hudline(in_row_node in xmldom.DOMNode, in_clob
clob, out_sts out char, out_msg out varchar2) is
begin
declare
V_LOAN_NBR WHL_LOAN_TB.LOAN_NBR%TYPE;
V_HUDLINE_NBR WHL_HUDLINE_TB.HUDLINE_NBR%TYPE;
V_KEY_EXISTS NUMBER;
v_rows_updt number;
v_nbr number;
v_msg varchar2(200);
begin
v_loan_nbr := xslprocessor.valueof(in_row_node,'LOAN_NBR');
v_hudline_nbr := xslprocessor.valueof
(in_row_node,'HUDLINE_NBR');
select count(*) into v_key_exists from whl_hudline_tb
where loan_nbr = v_loan_nbr
and hudline_nbr = v_hudline_nbr;
if v_key_exists > 0 then
v_rows_updt := DBMS_XMLSave.updateXML
(hudline_Ctx,in_clob);
else
v_rows_updt := DBMS_XMLSave.insertXML
(hudline_Ctx,in_clob);
END IF;
if v_rows_updt = 0 then -- Error no rows were inserted
or updated
out_sts := '01';
out_msg := 'UPDT_HUDLINE - insert/update did not
update any rows for:'||V_LOAN_NBR||':'||
V_HUDLINE_NBR||':'||V_KEY_EXISTS;
else
out_sts := '00';
end if;
exception
when others then
-- get the original exception
DBMS_XMLQuery.getExceptionContent(HUDLINE_Ctx,v_nbr,
v_msg);
dbms_output.put_line('updt_hudline Exception caught ' ||
TO_CHAR(v_nbr)
|| out_msg );
out_sts := '99';
out_msg := 'updt_hudline:'||v_msg;
end;
end updt_hudline;
procedure set_context(in_table_name in varchar2, out_sts out
char, out_msg out varchar2) is
begin
declare
v_nbr number;
v_msg varchar2(200);
begin
if in_table_name = 'WHL_HUDLINE_TB' then
if HUDLINE_CTX_IND = 'N' THEN -- Context has not been created
for the table
HUDLINE_Ctx := DBMS_XMLSave.newContext('WHL_HUDLINE_TB');
DBMS_XMLSave.clearUpdateColumnList(HUDLINE_Ctx); -- To
test
DBMS_XMLSave.clearKeyColumnList(HUDLINE_Ctx);
DBMS_XMLSave.setKeyColumn(HUDLINE_Ctx,'LOAN_NBR');
DBMS_XMLSave.setKeyColumn(HUDLINE_Ctx,'HUDLINE_NBR');
DBMS_XMLSave.setCommitBatch(HUDLINE_Ctx, 0);
HUDLINE_CTX_IND := 'Y';
END IF;
END IF;
out_sts := '00';
exception
when others then
-- get the original exception
DBMS_XMLQuery.getExceptionContent(HUDLINE_Ctx,v_nbr,
v_msg);
dbms_output.put_line('set_context Exception caught ' ||
TO_CHAR(v_nbr)
|| out_msg );
out_sts := '99';
out_msg := 'set_context error:'||v_msg;
end;
end set_context;
end whl_rtl_xml_pkg;
procedure kim_test as
begin
declare
in_long long := '<ROOT>
<ROWSET>
<TABLE_NAME>WHL_HUDLINE_TB</TABLE_NAME>
<ROW num="3">
<LOAN_NBR>6000012</LOAN_NBR>
<HUDLINE_NBR>104.3</HUDLINE_NBR>
<HUDLINE_AMT>700</HUDLINE_AMT>
<HUDLINE_PYMNT_MTHD_CD>A</HUDLINE_PYMNT_MTHD_CD>
<HUDLINE_COMMENT_TXT>THIS IS A
COMMENT</HUDLINE_COMMENT_TXT>
</ROW>
<ROW num="4">
<LOAN_NBR>6000012</LOAN_NBR>
<HUDLINE_NBR>104.4</HUDLINE_NBR>
<HUDLINE_AMT>700</HUDLINE_AMT>
<HUDLINE_PYMNT_MTHD_CD>A</HUDLINE_PYMNT_MTHD_CD>
<HUDLINE_COMMENT_TXT>THIS IS A
COMMENT</HUDLINE_COMMENT_TXT>
</ROWSET>
</ROOT>';
out_err_sts char(2);
out_err_msg varchar2(200);
begin
WHL_rtl_xml_pkg.accept_xml (in_long, out_err_sts, out_err_msg);
dbms_output.put_line(out_err_msg);
end;
end;
Output from running it
SQL> edit
Wrote file afiedt.buf
1 delete from whl_hudline_tb
2* where loan_nbr = '6606665'
SQL> /
2 rows deleted.
SQL> commit;
Commit complete.
SQL> set serveroutput on
SQL> execute kim_test
WHL_RTL_XML_PKG.ACCEPT_XML Finished without errors
PL/SQL procedure successfully completed.
SQL> select loan_nbr, hudline_nbr, hudline_amt
2 from whl_hudline_tb
3 where loan_nbr = '6606665';
LOAN_NB HUDLIN HUDLINE_AMT
6606665 104.3 700
6606665 104.4 700
SQL> rollback;
Rollback complete.
SQL> select loan_nbr, hudline_nbr, hudline_amt
2 from whl_hudline_tb
3 where loan_nbr = '6606665';
LOAN_NB HUDLIN HUDLINE_AMT
6606665 104.3 700
6606665 104.4 700 -
Creating the materialized view using the database link
Hi Guys,
I am using the Oracle 11g release version.
Following is my question,
I had created the Database link to get the data from remote DB table.
Using that DB link, i can access the required table using SELECT statment.
When i tried to create the materialized using that DB link.
I am getting the error SQL Error: ORA-00942: table or view does not exist.
Can anyone please find the root cause and provide the solution for this?
TIA,
Dhivakar.Hi Dhivakar,
try like this
CREATE DATABASE LINK test
CONNECT TO scott IDENTIFIED BY tiger
USING 'orcl';
Pls make sure the table name.which ur using to create the materialized view.Thanks
Venkadesh -
Creating classification view for the material
hi friends,
i need to create a material with various views (as in MM03) based on the material type.
i am using BAPI_MATERIAL_SAVEDATA for it.
i am able to create almost all the views except the the classification view for the material.
can anyone help me with code (i need to write) to create a classification view for the material?
thanks in advance.Hi Karthik,
Select klart from AUSP into table t_ausp where OBJEK = wa_final-matnr.
LOOP AT t_ausp.
w_classtype = t_ausp-klart.
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
classtext = 'X'
classtype = w_classtype
language = sy-langu
object = w_object
objecttable = 'MARA'
* no_value_descript = w_no_value_descript
change_service_clf = 'X'
inherited_char = ' '
change_number = ' '
TABLES
t_class = t_class
t_objectdata = t_objectdata
i_sel_characteristic = i_sel_characteristic
t_no_auth_charact = t_no_auth_charact
EXCEPTIONS
no_classification = 1
no_classtypes = 2
invalid_class_type = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
LOOP AT t_class WHERE class IN s_class.
CLEAR : t_allocvaluesnum,t_allocvalueschar,t_allocvaluescurr,
t_lreturn.
REFRESH : t_allocvaluesnum,t_allocvalueschar,t_allocvaluescurr,
t_lreturn.
w_classnum = t_class-class.
* Getting the reference tables and values----------------
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = w_objectkey "Old reference Material
objecttable = 'MARA'
classnum = w_classnum
classtype = w_classtype
* unvaluated_chars = 'X'
TABLES
allocvaluesnum = t_allocvaluesnum
allocvalueschar = t_allocvalueschar
allocvaluescurr = t_allocvaluescurr
return = t_lreturn.
* Create with reference-----------------------
w_objectkeynew = wa_inputfile-to_matnr.
CALL FUNCTION 'BAPI_OBJCL_CREATE'
EXPORTING
objectkeynew = w_objectkeynew "New Material
objecttablenew = 'MARA'
classnumnew = w_classnum
classtypenew = w_classtype
TABLES
allocvaluesnum = t_allocvaluesnum
allocvalueschar = t_allocvalueschar
allocvaluescurr = t_allocvaluescurr
return = t_lreturn.
ENDLOOP.
ENDLOOP.
Prabhudas -
How to create XMLTYPE View from the XMLType table
Hi:
I have a large XML file and inserted to the XMLTYPE table
For the XQUERY purpose I would like to create XMLView of the table.
The examples I got from Oracle to create XML view are for small files.
Can some one help me how to create XMLType VIEW for large XML Files ( 20,000 lines )?
Ali_2Have a look at the examples given on XMLType Views (based on relational tables) or standard views (based on XMLType storage) in the FAQ url located on the main page of this forum site regarding XMLDB.
-
Script to fetch the script of a existing view from the Database
Hi,
How to fetch a existing view's information (SCRIPT) dynamically from the database.
Thanks in advance
Regards,
Mr.RI did not post to ask this question.
I try on the command line on SQL it prompts the first line of the script. How is the rest of the script?
QL> select dbms_metadata.get_ddl('VIEW','MY_VIEW') from dual;
BMS_METADATA.GET_DDL('VIEW','MY_VIEW')
CREATE OR REPLACE FORCE VIEW "MY_USER"."MY_VIEW" ("USER_ID *<== How to fetch the rest of the script.* -
How to view definition of a view in the database
Hi !
I want to see the definition of a view that has already been created in the database. Incidently I misplaced its script. How can I see the definition since when I go to all_views table, it shows text as long datatype aand can't be displayed in sql*plus nor am I able to insert it into a new table as it gives error..."illegal use of Long datatype "
Any help will be welcome..
Regards,
Shobhitat the sqlplus prompt,
set long 50000
Then you should be able to see the entire view definition at the sqlplus prompt.
You should not perform any dml operations in system level tables like all_views, dba_views etc.
-Ashutosh
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by shobhit kumar:
Hi !
I want to see the definition of a view that has already been created in the database. Incidently I misplaced its script. How can I see the definition since when I go to all_views table, it shows text as long datatype aand can't be displayed in sql*plus nor am I able to insert it into a new table as it gives error..."illegal use of Long datatype "
Any help will be welcome..
Regards,
Shobhit<HR></BLOCKQUOTE>
null -
Creating .bat for analyzing the Database.
Hi Experts,
I am having a doubt in scheduling database analysis process windows 2003 server.
Every Sunday, we have to schedule the database analysis. just view the below example
sysuser login id : testlogin
sysuser password: demotest
connection string: demotest
file - demo.sql is available in d:\
Now i need to create a .bat file for scheduling purpose.
in the bat file, i want to connect as sysuser and then execute the above mentioned sql file. please suggest me how to give the syntax for connecting to oracle database as sysuser through a .bat file.
One more doubt: we have to analyze the database in sysuser mode only or also in local user mode???
suggest me about this...
Thanks in Advance.oracle recommends generation of statistics using dbms_stats package with
dbms_jobs package.
You can use following procedure as sys user
variable jobno number;
variable instno number;
begin
select instance_number into :instno from v$instance;
dbms_job.submit(:jobno, 'dbms_stats.GATHER_SCHEMA_STATS(ownname=>'<schema Name>,OPTIONS=>''GATHER'',cascade=>TRUE);', TO_DATE('18-JUN-05--21','DD-MON-YY--HH24'), '(SYSDATE+1)', TRUE, :instno);
commit;
end;
/ -
version 5 loaded on windows 7. all went well for a while. one day while using, ratio of normal screen doubled in width; i.e. half the page disappears off the screen to the right (on a wide screen). when full screen mode applied, ratio is fine. it only happens in normal view, which is the usually prefered option. I cannot determine any means within the program to resize the normal screen. nothing else is affected, only mozilla firefox in normal view. not that when program is opened from keyboard the page is correct for a moment, then enlarges the width with 1/2 page dissappearing.
This issue can be caused by the Babylon Toolbar 1.1.8 extension
*https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode
Maybe you are looking for
-
Unable to swap web app (FKA Website) deployments and cannot update configuration
We are trying to deploy an update to one of our web apps (Hosted in Northern Europe.). Our process is to deploy to a "staging" deployment slot, then swap. When we try to do this we get the following error: Failed to swap web app slot production with
-
Mac OS X 10.5.8 Leopard, on my old stationary PC ??
Hi... i Wounder if you could install Mac OS X Leopard on a old stationary PC with 1,5 Ghz intel processor 512 mb ddr2 ram, and a old Nvidia G-Force 6200 series video-card ?? All i need is, format my hard drive to the Mac format ?? Is it possible to g
-
Addenda information for ACH payments
Hi All, We are using PMW with an ACH CCD format to send the ACH files to our Bank. But certain vendors require us to send ADDENDA record as given below for e.g. in the ACH payments 705ISA00NV 00NV ZZNV ZZNV 09100615300010000001 Can we enter this inf
-
Active Directory Error(error code 53 - 0000001F)
Hello, We got a webapp writing to AD, that is throwing the following error: Root exception is javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 0000001F: SvcErr: DSID-031A0FC0, problem 5003 (WILL_NOT_PERFORM), data 0We are using 'un
-
Configuring Adobe Acrobat XI Pro with SharePoint 2013
Hello, There are multiple questions whose clarifications are required. Situation: Users need to open the documents in browser, check-out, edit, add comments/annotations and check-in without using Client Acrobat Reader. Based on the above situation, p