Solved

Adding/Modifying SQL query to an Oracle's table views

Posted on 2013-01-02
4
466 Views
Last Modified: 2013-01-02
Dear Experts,

I have an Oracle's table view named "HOURLY_DATA" with the following query:


  CREATE OR REPLACE FORCE VIEW "MISSION"."HOURLY_DATA" ("DAY", "TIME", "TAGID", "TURBINE", "VALUE", "CNT", "UP_CNT", "PEAK", "MINIMUM") AS
  select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1301 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1302 a  union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1303 a  union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1304 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1305 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1306 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1307 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1308 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1309 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1310 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1311 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from HOURLY_1312 a union all
select a.day, a.time, a.tagid, a.turbine, a.value, a.cnt, a.up_cnt, a.peak, a.minimum
from hourly_1212 a;

When I validated it, there were couple of tables that weren't created at the time, so it failed.  After I cancelled out the query validation, everything is gone.  I'd like to put the above query back into that "HOURLY_DATA" table view using Oracle SQL Developer.  Could you please let me know how this can be done?  Thanks.
0
Comment
Question by:swgit
  • 2
  • 2
4 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38737968
I'm not a SQL Developer expert but can you not just paste that create statement into the SQL worksheet and execute it?

Also, you should not use double quotes around Oracle object names.  It forces case sensitivity and will cause you problems in the future if you have a lower case character in the name.
0
 
LVL 1

Author Comment

by:swgit
ID: 38737987
I guess I can, but I don't know how.  How do I access the "worksheet"?  Please advise.  If it's easier for you to instruct via command, I can do that as well.  I'm running Oracle 11g, and am very new to Oracle.  Hence, the detail steps would be greatly appreciated.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 38738009
>>How do I access the "worksheet"?  

Check out this small how-to tutorial.

http://www.oracle.com/technetwork/developer-tools/sql-developer/query-intro-1-161240.html

>>via command, I can do that as well

When you installed Oracle on the server or if you installed the client on your worksatation, you should have sqlplus.  This is the command line access to Oracle.
0
 
LVL 1

Author Closing Comment

by:swgit
ID: 38738040
@slightwv - you rock!!  thanks so much!  got it :)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now