The use of dbms_passthrough to create a view of the
Gurus,Can I create a view in oracle to access data frm a MysqlDB using dbms_passthrough. I created a procedure to get the data from the remote system to oracle db using dbms_passthrough but I was wondering if this can be done by using a view
Published by: user10600431 on January 22, 2009 04:39
Published by: user10600431 on January 22, 2009 05:52
user10600431 wrote:
Yes but I have as many functions and views on top of these tables, unless the function can be dynamic to fetch the result according to the charts.
You can create a function with the SQL statement, or just the name of table MySql as a parameter. However, you will need to create 50 views. Something like:
CREATE OR REPLACE VIEW view-N-name AS SELECT list-of-attributes FROM TABLE(function_name('select-from-mysql-tableN'))
/
SY.
Tags: Database
Similar Questions
-
Create table works, create materialized view only - long column names?
Hello.
I have no probs creating a table as well: -.
CREATE TABLE blah
(
DEVICE_ID
)
in select
"Device_ID" AS DEVICE_ID
"of"sum" Device"@ed_link_3
where "Device_ID" < 5;
But when I try to create a materialized view:
Blah1 CREATE MATERIALIZED VIEW
(
DEVICE_ID
)
< various materialized view parms >
in select
"Device_ID" AS DEVICE_ID
"of"sum" Device"@ed_link_3
where "Device_ID" < 5;
It fails with errors: -.
ORA-04052: error occurred when searching to the top of the remote object Aggregate.Device@ED_LINK_3
ORA-01948: length of the name of the identifier (31) exceeds maximum (30)
Is there a way to get around this?
Is the problem with the columns of the remote table of device, which I do NOT need to import to have column names that are longer than 30 characters?
For now, I want only the Device_ID column which is a simple 9 characters long.
Oh, and the remote database is MySQL.
I'm uncomfortable with the < parms of materialized view > as they work fine when I choose a different remote table with only short column names.
Thank you.To my knowledge, you have the option
(a) create view (with shortened column names or only with desired columns if they are already less than 30 char limit) side of mysql
(b) use dbms_passthrough to force the analysis to be done on mysql (as in the example provided by SY here use dbms_passthrough to create a view )
However, I prefer to stick to one), because with dbms_passtrhough, you retrieve row by row.Best regards
Maxim
-
I need assistance with a request that I need to use in order to create a view.
It's pretty complicated, at least for me.
Here is a brief summary of the problem:
There is a table called involved seller.
This table has a four digit salespersonid, lastname, firstname, hiredate, and supervisor of the columns.
The supervisor column holds the salespersonid contractor of this particular sales person four-digit.
This column is null if this seller is the prime contractor.
Now, I need to generate a view that summarizes sales of books by the seller and the shipping status.
7 columns are required.
SalesPersonID
Seller name
State (based on shipstate)
Total number of orders
total amount of sales
Total profit
The name of the person's supervisor.
It is the last one who gives me fits.
I don't know how to get the supervisor last name in the output.
In addition, if the seller is the prime contractor (i.e. the supervisor column is null) I need to view (none) it. It can not be empty.
Here's what I have so far:
It seems to me that I have to use a self-join, but my brain is cooked, and I can't seem to understand this.SELECT s.salespersonid AS ID, s.lastname || ', ' || s.firstname AS salesperson, shipstate, COUNT(DISTINCT order#) AS "TOTAL ORDERS", SUM(retail * quantity) AS "GROSS SALES", SUM((retail - cost) * quantity) AS "PROFIT" FROM salesperson s LEFT JOIN orders o ON s.salespersonid = o.salespersonid LEFT JOIN orderitems oi ON o.order# = oi.order# LEFT JOIN books b ON oi.isbn = b.isbn GROUP BY s.salespersonid, s.lastname || ', ' || s.firstname, shipstate
I have scripts that would generate the tables and the data that I use.
It's a small database. (If anyone is familiar with Oracle 10 g SQL Joan Casteel by, it's the JustLeeBooks database used throughout this book)
I don't really want to post these scripts here. It would for a long post.
There are seven of them to get consistent data with what I use here.
If someone is willing to spend the time to help me, I e-mail them scripts.
They are the script that configures the initial database and then 6 more scripts that I wrote to get to this point.
They sort of build on each other.
Send me a private message if you're willing to do.
We could then put the discussion here if it's to your liking.
Notice to lovers?
Maybe someone can help without these scripts?Hello..
If I understand you need this query can help you...
SELECT s.salespersonid AS ID, s.lastname || ', ' || s.firstname AS salesperson, shipstate, COUNT(DISTINCT order#) AS "TOTAL ORDERS", SUM(retail * quantity) AS "GROSS SALES", SUM((retail - cost) * quantity) AS "PROFIT", nvl(sup.lastname || ', ' || sup.firstname,'none') AS supervisor FROM salesperson s LEFT JOIN orders o ON s.salespersonid = o.salespersonid LEFT JOIN orderitems oi ON o.order# = oi.order# LEFT JOIN books b ON oi.isbn = b.isbn LEFT JOIN salesperson sup ON s.supervisorid = sup.salespersonid GROUP BY s.salespersonid, s.lastname || ', ' || s.firstname, shipstate, nvl(sup.lastname || ', ' || sup.firstname,'none')
Not tested.
Tell me if it is that need you!
-
Hi all
I am beginner in Oracle.
I have a two-column table that I use to create a view documents/statement once it meets the qualification.
The table has fields. 1 number and 2. Group. If there is more than 3 records found on this table with the same NUMBER and the GROUP he should create this table view.
Thank you
Pramod Devkate
The training is therefore two lines for a ticket and the agent. When the third row is added, create a line in the summary table. Later a fourth line is added to the table of training for this ticket and the agent, but we do not update the line in the summary table. We only touch the summary table when the third row is added to the training table, then it is only updated by the application. Very well
INSERT INTO summary (ticket, agent, total_travel, total_mtts)
Select ticket agent, sum (travel), sum (mtts)
training
where (ticket, agent) not in
(select the ticket agent summary)
Group ticket, agent
having count (*) > 2.
This inserts in the table only notes and agent ID that do not exist already.
-
creating a view and use the view in a model
Hi all
I'm new to OBIEE, and I have a requirement that I have two fields to be added to a domain. Because we cannot add queries directly to a model, I have to create a view and then put the request in it, and then use the view in this model.
I did not understand this well, if someone could help me, explaining in detail the view and adding a query in it?
Thank you
GohanHello
(a) If you want to use your existing DB view please tick box import meta option data - RPD--> file menu
(b) If you want to create the new view in RPD itself just right click anyof a physical table--> properties--> click the genral--> change the type of array as "Select" then you create/update your sql query, and then click ok that's all
Once created, you can deploy advice on the database (right mouse button) or you can leave the view cancelled (worst performance).Ref steps more to create views
http://gerardnico.com/wiki/dat/OBIEE/opaque_view
http://allaboutobiee.blogspot.com/2012/05/OBIEE-11g-deployundeploy-view-in.htmlThank you
Deva -
Creating a view using multiple joins - by reducing the number of output lines
It is difficult to put into words exactly what I want to implement, so I'll just use an example. Let's say I have the following database:
game (id, time, place)
Reader (game_id, name)
Referee (game_id, name)
Foreign keys:
Player (game_id) references game (id)
Referee (game_id) references game (id)
It is a very special match, in which:
A game can have 1 to many players
A game can have from 1 to several arbitrators
I want to create the following view:
Game_overview (Game_id, time, player, referee)
It's easy to create this view with the following output:
Game1, 15:00, player1, Referee1
Game1, 15:00, player1, Referee2
Game1, 15:00, player2, Referee1
Game1, 15:00, player2, Referee2
Game1, 15:00, Joueur3, null
08:00, player1, Referee1, GaMe2
GaMe2, 08:00, player1, Referee2
HOWEVER, I want it to look like this:
Game1, 15:00, player1, Referee1
Game1, 15:00, player2, Referee2
Game1, 15:00, Joueur3, null
08:00, player1, Referee1, GaMe2
GaMe2, 08:00, null, Referee2
I think that this should not be TOO difficult to solve, but I can't really get my head around it.Welcome to the forum!
Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data. Sinve it's your first post, I'll do it for you:
CREATE TABLE game ( id VARCHAR2 (10) PRIMARY KEY , time VARCHAR2 (10) --, location VARCHAR2 (10) -- No need to include columns that play no role in this problem ); INSERT INTO game (id, time) VALUES ('Game 1', '3PM'); INSERT INTO game (id, time) VALUES ('Game 2', '8AM'); CREATE TABLE player ( game_id VARCHAR2 (10) , name VARCHAR2 (10) ); INSERT INTO player (game_id, name) VALUES ('Game 1', 'Player 1'); INSERT INTO player (game_id, name) VALUES ('Game 1', 'Player 2'); INSERT INTO player (game_id, name) VALUES ('Game 1', 'Player 3'); INSERT INTO player (game_id, name) VALUES ('Game 2', 'Player 1'); CREATE TABLE referee ( game_id VARCHAR2 (10) , name VARCHAR2 (10) ); INSERT INTO referee (game_id, name) VALUES ('Game 1', 'Referee 1'); INSERT INTO referee (game_id, name) VALUES ('Game 1', 'Referee 2'); INSERT INTO referee (game_id, name) VALUES ('Game 2', 'Referee 1'); INSERT INTO referee (game_id, name) VALUES ('Game 2', 'Referee 2');
In this way, people who want to help you can recreate the problem and test their ideas.
In addition, to say what version of Oracle you are using. The following query will work in Oracle 9.1 or more.
What you asked is what I call a Query, fixed-price , and this is a way to do it:
WITH player_plus AS ( SELECT game_id , name , ROW_NUMBER () OVER ( PARTITION BY game_id ORDER BY name ) AS r_num FROM player ) , referee_plus AS ( SELECT game_id , name , ROW_NUMBER () OVER ( PARTITION BY game_id ORDER BY name ) AS r_num FROM referee ) SELECT g.id , g.time , p.name AS player_name , r.name AS referee_name FROM player_plus p FULL OUTER JOIN referee_plus r ON p.game_id = r.game_id AND p.r_num = r.r_num JOIN game g ON g.id = COALESCE (p.game_id, r.game_id) ORDER BY g.id , COALESCE (p.r_num, r.r_num) ;
Output:
ID TIME PLAYER_NAM REFEREE_NA ---------- ---------- ---------- ---------- Game 1 3PM Player 1 Referee 1 Game 1 3PM Player 2 Referee 2 Game 1 3PM Player 3 Game 2 8AM Player 1 Referee 1 Game 2 8AM Referee 2
I see that you have more arbitrators than players in a game. If such was not the case, then you might make it a bit more efficient using a LEFT OUTER JOIN between p and r, rather than a FULL OUTER JOIN, and you can also use only the columns of p where I use COALESCE.
Published by: Frank Kulash, March 9, 2012 18:15
Fixed spelling -
Cannot create Materialized View using the PL/SQL procedure
Hello
I have a question related to the creation of materialized view.
I have a stored procedure that creates the materialized view. When you try to perform this procedure, I get not enough privileges error: ORA-01031.
When I run the content of this procedure as a PL/SQL block anonymous their materialized view is created without any complications.
Can you please advice me on this subject?
It is even possible to create a materialized view in the stored procedure as I found no info on this subject.
Thank you
PetrHi chudapet,
Whenever you make in procedure, you must have direct subsidies and not through a role.
Most likely the grant to create a materialized view is available via a role to your username.
Assign a direct grant to the user:grant create materialized view to scott; {code}
-
Creating a view using causes error ORA-00600
Hello ladies and gentlemen,
I tried to deploy a recursive query, as a point of view in Oracle XE and Standard Edition, nor a lot of success.
The query is in this issue here: http://stackoverflow.com/questions/17358109/how-to-retrieve-all-recursive-children-of-parent-row-in-oracle-sq
with recursion_view(base, parent_id, child_id, qty) as ( -- first step, get rows to start with select parent_id base, parent_id, child_id, qty from md_boms union all -- subsequent steps select -- retain base value from previous level previous_level.base, -- get information from current level current_level.parent_id, current_level.child_id, -- accumulate sum (previous_level.qty + current_level.qty) as qty from recursion_view previous_level, md_boms current_level where current_level.parent_id = previous_level.child_id ) select base, parent_id, child_id, qty from recursion_view order by base, parent_id, child_id
The query itself works and returns the results. However, when I try to create a view with this query, I get errors.
I posted two screenshots: http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/ViewError.jpg and http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/InternalError.jpg one with the! and * is when I am using JDeveloper 11g, using the navigation database, right-click on the view and select "New View". I get the error when I click on OK. I can indeed create the view through a sql script, but when I try to view the data, I get the error ORA_00600.
I tried it work on my machine the two premises for XE (version 11.2.0.2.0) and 11g Standard Edition (11.2.0.2.v6) via Amazon Web Services. The result is the same.
Does anyone know how to get around this problem?
Not 5 minutes after I have this post, I decide not to use the graphical editor of JDev and simply write
SELECT * FROM BOMS_VIEW;
And it works like a charm. I can not just use data tab to display records in the editor. Wish I'd known that there is 5 hours.
-
create materialized view log on the table without a primary key
Hi all
I don't want to refresh the mview when validation is performed on the base table.CREATE TABLE client_months ( SUBJ_CODE NUMBER(4), SERV_CODE NUMBER(4), DEBIT_CODE NUMBER(4), PERIOD_NUM NUMBER(2), PERIOD_NAME VARCHAR2(40 CHAR), FIRST_MON_DAY DATE, LAST_MON_DAY DATE, VALUE_MON_DAY DATE, MONTHES NUMBER(4,2), GARDENING_WEIGHT NUMBER(5,4), REASON_CODE NUMBER(5), STAMP_ACTION VARCHAR2(1 CHAR), STAMP_CDATE DATE DEFAULT SYSDATE, STAMP_DATE DATE, STAMP_USER VARCHAR2(15 CHAR), REGION_CODE NUMBER(9) ) table created. CREATE UNIQUE INDEX client_months_UK ON client_months (SUBJ_CODE, SERV_CODE, DEBIT_CODE, PERIOD_NUM, REGION_CODE) index created. CREATE MATERIALIZED VIEW LOG ON client_months with rowid; CREATE MATERIALIZED VIEW client_months_mv BUILD immediate REFRESH FAST ON COMMIT AS SELECT * FROM client_months; ORA-12014: table 'CLIENT_MONTHS' does not contain a primary key constraint
And I don't want to change the base table by adding a primary key.
is it possible to create the mview journal using the unique index? or another solution?
Please help
Thanks in advance
NaamaNaamas wrote:
No,
I already read this post!Then you read wrong:
SQL> CREATE TABLE client_months 2 ( 3 SUBJ_CODE NUMBER(4), 4 SERV_CODE NUMBER(4), 5 DEBIT_CODE NUMBER(4), 6 PERIOD_NUM NUMBER(2), 7 PERIOD_NAME VARCHAR2(40 CHAR), 8 FIRST_MON_DAY DATE, 9 LAST_MON_DAY DATE, 10 VALUE_MON_DAY DATE, 11 MONTHES NUMBER(4,2), 12 GARDENING_WEIGHT NUMBER(5,4), 13 REASON_CODE NUMBER(5), 14 STAMP_ACTION VARCHAR2(1 CHAR), 15 STAMP_CDATE DATE DEFAULT SYSDATE, 16 STAMP_DATE DATE, 17 STAMP_USER VARCHAR2(15 CHAR), 18 REGION_CODE NUMBER(9) 19 ) 20 / Table created. SQL> CREATE UNIQUE INDEX client_months_UK ON client_months 2 (SUBJ_CODE, SERV_CODE, DEBIT_CODE, PERIOD_NUM, REGION_CODE) 3 / Index created. SQL> CREATE MATERIALIZED VIEW LOG ON client_months with rowid 2 / Materialized view log created. SQL> CREATE MATERIALIZED VIEW client_months_mv 2 BUILD immediate 3 REFRESH FAST WITH ROWID ON COMMIT -- pay attention to WITH ROWID 4 AS 5 SELECT * FROM client_months 6 / Materialized view created. SQL>
SY.
-
create a view with the double data type
I have Windows XP with 10g 10.2.0.1.0
I need to create a view of the double and with the type of data, such as NUMBER (5.2), NUMBER or VARCHAR2 (20).
such as:
create see test (view_test varchar2 (20)) as (select view_test from double)
Help, please. Thanks in advance.It seems a little strange, but you can do something like this with the CAST function:
SQL> create view dual_view as 2 select cast(null as number(5,2)) col1 3 ,cast(null as date) col2 4 ,cast(null as varchar2(30)) col3 5 from dual; View created. SQL> desc dual_view Name Null? Type ----------------------------------------- -------- ------------------------- COL1 NUMBER(5,2) COL2 DATE COL3 VARCHAR2(30)
I used the NULL values, but you can use the actual values if you wish.
-
Creating a view of mast bearing the same name with the name of the table
Hello world
After having dropped the name of view mast QQ. "" TRDLN_DIM_MV ", I try to recreate by having the same name as the table, but I got an error message stating that"the name is already used by an existing object. How to create a matte view to resemble the object possessed by schema 'GQ', with a name identical to the name of the table, drop the table?
OWNER_O CREATED LAST_DDL_ TIMESTAMP STATUS OBJECT_NAME OBJECT_TYPE
===
GQ MATERIALIZED VIEW 5 NOVEMBER 08 2008 13 DECEMBER 08-11 - 05:06:31:46 TRDLN_DIM_MV VALID
GQ TABLE 5 NOVEMBER 08 2008 15 DECEMBER 08-11 - 05:06:31:00 TRDLN_DIM_MV VALID
QQ TABLE 17 AUGUST 07 16 MARCH 09 2007-08 - 17:17:05:21 TRDLN_DIM_MV VALID
SQL & gt; CREATE THE QQ MATERIALIZED VIEW. TRDLN_DIM_MV
2 TABLESPACE FPLC01S
3 NOCACHE
4 NOLOGGING
5 PACK
6 PARALLEL (DEGREE 1 2 INSTANCES)
7 BUILD IMMEDIATE
8 REFRESH FORCE ON REQUEST
9 WITH PRIMARY KEY
10 AS
11 Select / * + NO_REWRITE * / trdln_id,.
trdln_skid 12,
trdln_end_date 13,
FIRST_VALUE (trdln_end_date) 14 over (partition by order of trdln_id trdln_end_date DESC) as MaxDate
15 QQ.trdln_dim;
of QQ.trdln_dim
*
ERROR on line 15:
ORA-00955: name is already used by an existing object
I appreciate your help. Thanks in advance!
Kind regards
RadicYou must rename the table (using ALTER TABLE TableName RENAME to othername ;) before creating the MV.
You cannot have both existing with the same name in the same schema.What you see in the scheme of GQ, is that the 'picture' is the underlying table for the materialized view.
When you do a MY_MV CREATE MATERIALIZED VIEW AS...
Oracle creates two objects with the same name, we the MY_MV materialized view, and the other being the MY_MV table, which is the physical storage. {Don't forget that a materialized view is a way to get a physical representation of views.}In the schema QQ is what you
a. a real Table
or
b. a MV incorrectly deleted, resulting in the underlying Table always presents. -
10.6.8 using. With Safari I can view the Apple start page. OK, using Firefox. What happens in the last 24 hours. How can I solve this?
You can solve it using only not the OS X version 10.6, Apple Safari here on out!
Over the years, there were no updating security for what be for OS X 10.6.8 Snow Leopard!
This version of Safari is obsolete and has not been safe to use for many years.
There is one more, last recommended Mozilla Firefox web browser update complete (worms) 48.0.0 that is always available, and probably will be more safe to use until the end of the year.
https://www.Mozilla.org/en-us/Firefox/desktop/
Mozilla is complete, at the end of the present in August, full support for Firefox on OS X 10.6 - 10, 8.
OR
Guaranteed ONLY (not more new web browser feature) support for an earlier version of th is permanent to Mozilla Firefox, web browser (worms. 45.0.0) through their program of Firefox ESR, (that you CAN download, install and use) which will continue to receive the support of a security update to Firefox until next April 2017 for OS X 10.6-10, 8.
You can use these versions of the ESR. Ignore the notes support educational/business.
https://www.Mozilla.org/en-us/Firefox/organizations/FAQ/
OR
See SeaMonkey.
http://www.SeaMonkey-project.org/
Good luck!
-
Hello
We have recently implemented Foglight and VMware plugin. As part of the VMware plugin, Foglight pulls in all the Linux VM machines including the ESX host. Our team of Linux only manages the running redhat Linux hosts. They fail the ESX VM guest. That said, is there a way to create a view that shows only the hosts running redhat Linux?
For example the view of rail infrastructure below contains 88 Linux machines, but nearly half of them are ESX hosts for our Linux team would not see all these. Is it possible to filter these?
Any help is appreciated.
Thank you
Tony
The easiest way would be to create a personalized, pair it with Infrastructure and then create a dynamic management component. This will help create you a rule for "All hosts" where you can find just the hosts that are not of the ESX host and run Linux.
The query would be:
detail.topologyTypeName! = "VMWESXServer" & os.longName like «% Linux»
-
Hello
I would like to know how to use PL/SQL to create dynamic action to set the value of a list of selection by another selection list.
I wish can create dynamic action to manage the two above the Room select list (: P9_ROOM) and building (: P8_BUILDING).
When you select "1074" in the bathroom, building highlights like "BRM BLD 5"
When you select 'Area of the black box' in the room, building must assign the value "7 BLD BRM"
When the room is Null, building should also be Null.
I thank you,
Alice
I forgot to mention, for the PL/SQL Code, because you are working with items in the selection list, the return values are different from the display on your LOV values, you must instead use the return values.
Thank you
Erick
-
How to create a Viewer without buying the image? I want to be able to save the images I'm looking a subject without purchase or download.
After talking to the Customer Service, I now get it. Thank you.
That is to say: down arrow recorded a watermark image in the gallery without you buy. You can download an overview lores on your desktop for motorhomes with this same arrow, but it is unfortunately a watermark (unlike the DPC). You can also copy and send a link to the Gallery clients to review before you buy.
Maybe you are looking for
-
How can I get the Awesome Bar Google search parameters?
For example: if I type "site:support.mozilla.org browser" in Google or even some new-tab for Firefox addons, I get a page with the Google search results on this site for that keyword. If I type the same line in the "Awesome Bar", I get an error page.
-
Where is the 'reading list' (glasses) in Safari?
Using Safari 9.0, I'm trying to figure out how I can add the 'Reading list' icon (glasses) to my bookmarks bar. I don't see that there is a tab bookmarks in Safari Preferences more.
-
Issue of Windows install I just bought a HP Photosmart printer and I am trying to install the software on my computer. (OS is Windows Vista.) When I try to install my software, I get an error message that "Windows Installer could not be accessed". I
-
How do I set up my hp6700 printer so that it prints in black and does not take into account all the colors?
-
Static and VPN on the external interface
Hello Can someone tell me if it is possible (and if so, how) do vpn enabled on the external interface and to have something like: public static x.x.x.x interface (indoor, outdoor) IE: I have two addresses ip - one for the router an e0 on the pix. I c