Help query Sql Oracle.
SELECT FIRST_NAME, SALARIES OF EMPLOYEESNOT THOUSANDS IN *.
3600 *.
2900 *.
2500 *.
4000 *.
3200 *.
SAL should come in the stars.
Please guide me on how to solve this problem.
Ref:
Replacement of number of asterisk
annual salaries with asterisks
Tags: Database
Similar Questions
-
Hello
We use Oracle 8i (Oracle8i Enterprise Edition Release * 8.1.7.4.0 - 64 bit Production *).
My requirement is-
I need output like
User_name company
Suri 01,86,65
Srinu 01,86,65
Here are examples of data.
Thank you very much in advance for the help.WITH t AS ( SELECT 'SURI' user_name ,'01' Company FROM dual UNION ALL SELECT 'SURI' user_name, '86' Company FROM dual UNION ALL SELECT 'SURI' user_name ,'65' Company FROM dual UNION ALL SELECT 'SRINU' user_name, '01' Company FROM dual UNION ALL SELECT 'SRINU' user_name ,'86' Company FROM dual UNION ALL SELECT 'SRINU' user_name ,'65' Company FROM dual ) SELECT * FROM t ; USER_NAME COMPANY SURI 01 SURI 86 SURI 65 SRINU 01 SRINU 86 SRINU 65
Thank you
SuriHello
Suri wrote:
... Only one doubt ROW_NUMBER will work in Oracle 8i?What happens when try you it?
It's in the manual of the SQL language for your version?
http://docs.Oracle.com/CD/A87860_01/doc/server.817/a85397/index.htm -
I'm trying to show the amount of time spent for each TVMREF for the week of October 3, 10 '-October 9, 10'. However, when the value of start_time begins before October 3, 10 ', or the end_time stops after October 9, 10 ', in other words, start_time and end_time span the specified week, the results don't return any time at all. I need to show the elapsed time for each TVMREF for the week in question. How to accomplish this seemingly impossible task?
Example table:
TVMREF ASSEMBLY START_DATE END_DATE
700 0 30 - SEPT. - 10 30 - SEPT - 10
700 0 30 - 7.-10 9 OCTOBER 10
636 0 7 OCTOBER 10 OCTOBER 8, 10
636 0 3 OCTOBER 10 OCTOBER 4, 10
636 0 6 OCTOBER 10 OCTOBER 6, 10
636 0 4 OCTOBER 10 OCTOBER 4, 10
636 0 1 OCTOBER 10 1 OCTOBER 10
635 0 3 OCTOBER 10 OCTOBER 3, 10
635 0 OCTOBER 1, 10 2 OCTOBER 10
635 0 1 OCTOBER 10 1 OCTOBER 10
635 0 30 - 7.-10 1ER OCTOBER 10
635 0 6 OCTOBER 10 OCTOBER 6, 10
635 0 3 OCTOBER 10 OCTOBER 4, 10
My query:
with a (too)
Select a.tvmref,
trunc (86400 *(a.end_time-a.start_time)) seconds
of reports.tvmdowntimes one
where a.assembly = 0
and a.start_time between October 3, 10 'and 9 October 10'
and a.tvmref < = "800"
order by 1)
Select
a.tvmref
round (sum(seconds/60/60), 2) as hours
a
A.tvmref group
order by 2 descNot exactly what you need, but it looks like:
with tvmdowntimes as ( select 700 tvmref,0 assembly,to_date('30-SEP-10','dd-mon-yy') start_time,to_date('30-SEP-10','dd-mon-yy') end_time from dual union all select 700,0,to_date('30-SEP-10','dd-mon-yy'),to_date('09-OCT-10','dd-mon-yy') from dual union all select 636,0,to_date('07-OCT-10','dd-mon-yy'),to_date('08-OCT-10','dd-mon-yy') from dual union all select 636,0,to_date('03-OCT-10','dd-mon-yy'),to_date('04-OCT-10','dd-mon-yy') from dual union all select 636,0,to_date('06-OCT-10','dd-mon-yy'),to_date('06-OCT-10','dd-mon-yy') from dual union all select 636,0,to_date('04-OCT-10','dd-mon-yy'),to_date('04-OCT-10','dd-mon-yy') from dual union all select 636,0,to_date('01-OCT-10','dd-mon-yy'),to_date('01-OCT-10','dd-mon-yy') from dual union all select 635,0,to_date('03-OCT-10','dd-mon-yy'),to_date('03-OCT-10','dd-mon-yy') from dual union all select 635,0,to_date('01-OCT-10','dd-mon-yy'),to_date('02-OCT-10','dd-mon-yy') from dual union all select 635,0,to_date('01-OCT-10','dd-mon-yy'),to_date('01-OCT-10','dd-mon-yy') from dual union all select 635,0,to_date('30-SEP-10','dd-mon-yy'),to_date('01-OCT-10','dd-mon-yy') from dual union all select 635,0,to_date('06-OCT-10','dd-mon-yy'),to_date('06-OCT-10','dd-mon-yy') from dual union all select 635,0,to_date('03-OCT-10','dd-mon-yy'),to_date('04-OCT-10','dd-mon-yy') from dual ) select a.tvmref, sum( case when a.start_time >= DATE'2010-10-03' and a.start_time < DATE'2010-10-10' then 86400*(a.end_time-a.start_time) end ) seconds from tvmdowntimes a where a.assembly = 0 and a.tvmref <= '800' group by a.tvmref order by 2 desc / TVMREF SECONDS ---------- ---------- 700 636 172800 635 86400 SQL>
SY.
-
SQL Query for Oracle DB followed by using vCOPS
Hi guys,.
I installed a general SQL adapter to monitor an Oracle database in my environment. But I am not able to make it work there are a lot of problems in writing a SQL Quries. I work with one of the DBA and we are still not able to write the query to the right. Can someone give me an example of a query so that I can test it or tell me how to write the query to Oracle DB. Examples of files that are given under/samples/folder conf in the plug-in does not help us. So if someone has a link or if someone has it please help me with query files.
Thanks in advance
fix. the biggest challenge with the SQL adapter is to write the query in such a way the release of product that is easily consumable by vcops and maps directly to RESOURCEKIND and RESOURCENAME in vcops. The result can also be hierarchical for more efficiency, i.e.
metric
-submetric1
-submetric2
-
Please, help me to query SQL Construct.
Hi Experts,Could you please help me to query SQL Construct. Please find the details
HOSTNAME HOSTTYPE DEM R1 R2
RS123 P ABC 24.5 265,5RS123 P CYC 24.5 265,5
RS123 P ADDS 24.5 265,5
RS123 P ADE 24.5 265,5
RS123 P SRC 24.5 265,5
EXPECTED RESULTS
HOSTNAME HOSTTYPE MNE R1 R2
RS123 P ABC, CYC, ADD, ADE, CBC 24.5 265,5Concerning
See you soon
with t as)
Select "RS123' hostname 'P' hosttype, 'ABC' dem, 24.5 r1, r2 265,5 Union double all the
Select 'RS123', 'P', "CYC", 24.5, 265,5 double Union all
Select 'RS123', 'P', 'ADD', 24.5, 265,5 double Union all
Select "RS123', 'P', 'ADE', 24.5, 265,5 double Union all
Select 'RS123', 'P', 'SRC', 24.5, 265,5 double
)
Select the host name,
HostType,
RTrim (XMLAGG (XmlElement(e,MNE,','). (Extract ('//Text ()')), ',') DEM,.
R1,
R2
t
Group hostname,
HostType,
R1,
R2
/
HOSTN H DEM R1 R2
----- - -------------------- ---------- ----------
RS123 P ABC, CBC, ADE, ADD, CYC 24.5 265,5SQL >
SY.
-
Convert the SQL query to Oracle
Hi all
I have two SQL queries to create the table.
Query1.
CREATE TABLE [dbo]. [DocumentType] (
[DocType] [varchar] (20) GATHER SQL_Latin1_General_CP1_CI_AS NOT NULL,.
[SubCat] [varchar] (20) GATHER SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo]. [DocumentType] ADD
CONSTRAINT [PK_DocumentType] PRIMARY KEY CLUSTER
(
[DocType],
[SubCat]) ON [PRIMARY]
Query2.
CREATE TABLE [dbo]. [SBU] (
[SBU] [varchar] (51) GATHER SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo]. [SBU] ADD
[PK_SBU] CLUSTERED PRIMARY KEY CONSTRAINT
(
[SBU]
) ON [PRIMARY]
What will be the query in Oracle?
Please suggest!
Kind regards
ShahQuery1.
CREATE TABLE dbo. DocumentType)
DocType varchar2 (20) NOT NULL,
SubCat varchar (20) NOT NULL,
CONSTRAINT PK_DocumentType PRIMARY KEY (DocType, SubCat)
)
/Query2.
CREATE TABLE dbo. SBU)
SBU varchar2 (51),
CONSTRAINT PK_SBU PRIMARY KEY (UDF)
)
/It is useful for you?
Published by: insa on June 12, 2012 22:42
-
Need help with query SQL Inline views + Group
Hello gurus,
I would really appreciate your time and effort on this application. I have the following data set.
Reference_No---Check_Number---Check_Date---description---Invoice_Number---Invoice_Type---Paid_Amount---Vendor_Number
1234567 11223 - 05/07/2008 -paid for cleaning- 44345563-I-* 20.00 *---19
1234567 11223 - 05/07/2008 - 44345563 -a--10,00---19 ofbad quality adjustment
7654321 11223 - 05/07/2008 - setting the last billing cycle - 23543556 - A - 50.00 - 19
4653456 11223 - 05/07/2008 - paid for cleaning - 35654765 - I - 30, 00-19
Please ignore '-' added for clarity
I'm writing a paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, aggregate query Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Type, Invoice_Number, Vendor_Number. When there are no more records I want to display the respective Description.
The query should return the following data set
Reference_No---Check_Number---Check_Date---description---Invoice_Number---Invoice_Type---Paid_Amount---Vendor_Number
1234567 11223 - 05/07/2008 -paid for cleaning- 44345563-I-* 10.00 *---19
7654321 11223 - 05/07/2008 - setting the last billing cycle - 23543556 - A - 50.00 - 19
4653456 11223 - 05/07/2008 - paid for cleaning - 35654765 - I - 30, 00-19
Here's my query. I'm a little lost.
Select b., A.sequence_id, A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
de)
Select sequence_id, check_number, check_date, invoice_number, sum (paid_amount) sum, vendor_number
of the INVOICE
Sequence_id group check_date, check_number, invoice_number, vendor_number
) A, B OF INVOICE
where A.sequence_id = B.sequence_id
Thank you
NickIt seems that this is a duplicate thread - correct me if I am wrong in this case->
Need help with query SQL Inline views + Group
Kind regards.
LOULOU.
-
Validation of a region defined as a QUERY SQL type (updated report)
Hello
I am trying to perform validation on a region defined as type of QUERY SQL (editable report). The report has two columns.
One of the columns is a Select list and I want to make sure that the user can select the same value twice
in the report. For example, if the selection list has 5 values A, B, C, D, E, I don't want a user to be able to select
B twice in the report. Will it use javascript to perform validation? If Yes, could someone provide some guidance on
where to embed the javascript? Are there other alternatives than javascript? I create an element that came from a sql query
counts the number of lines where the value of the column is the same. I then used the item in my validation logic. The problem with this logic
is that a user can enter the same value and it is not until the 3rd attempt to select the same value that the validation works using the number of lines which is why I think that I need to somehow capture the value of the selection list when a user selects and then compare it to what is already in the database column Select.
I hope that my question and explanations are clear.
Thanks in advance for your help,
MichaelHello
This can be managed using javascript or a validation of the page. Here is an example of use of javascript: [http://htmldb.oracle.com/pls/otn/f?p=267:7]
To do this, I have:
1 - a model of button which does not send the page but just runs javascript. The model will depend on your theme, but should include:
<a href="#BUTTON_ATTRIBUTES#">#LABEL#</a>
If #BUTTON_ATTRIBUTES # appears on the template, delete it as we need it only once. You must create a new button model based on a copy of your existing across models, shared components. Normally, he would show href = "" #LINK # "-we do not want that this would become doSubmit('buttonname')." If your model does not use tags for buttons, you might need to create one from scratch.
2 - I have updated the button on my page to use this template and then assign the setting button attributes:
javascript:check();
3. in the header of the HTML page, I added:
<script type="text/javascript"> function check() { var e = 0; var f = document.getElementsByName("f02"); var k1; var k2; var v1; var v2; if (f) { for (k1 = 0; k1 < (f.length - 1); k1++) { v1 = f[k1].value; for (k2 = (k1 + 1); k2 < f.length; k2++) { v2 = f[k2].value; if (v1 == v2) { e = 1; } } } } if (e > 0) { alert("Duplicates found!"); } else { doSubmit("SUBMIT"); } } </script>
In this example, SUBMIT is the name of the button and "f02" is the name attribute of the select list items that we want to check - change these needs by your page.
Now, when the Submit button is clicked, instead of directly submit the page, the javascript function is called. This function loops through each selection list and gets its value. Then, he compared it to the remaining items. If there is a match, the e flag is set to 1. After all the items have been verified, if e is not 0, then a message appears. Otherwise, the page is sent.
Andy
-
Create a simple query (SQL)
Hi experts,
I have a table with data as follows:
Database version: 10.2.0.4
Table name: TRANSACTION_HIST_TAB
and I want to create a single query (SQL) which can get data grouped by LOT_NO and only the first transaction by LOT_NOTRANS_ID LOT_NO PART_NO QTY TRANSACTION LOCATION_NO ROWVERSION --------- ------- -------- ---- ----------------- ------------ ---------------------- T00000X1 L001 ABC 10 CHANGE LOCATION WRH_1 01/01/13 08:00:00 AM T00000X2 L001 ABC 10 CHANGE LOCATION WRH_2 01/02/13 10:00:00 AM T00000X3 L002 XYZ 20 CHANGE LOCATION WRH_3 01/03/13 11:00:00 AM
Expected results:
Someone has an idea?TRANS_ID LOT_NO PART_NO QTY TRANSACTION LOCATION_NO ROWVERSION --------- ------- -------- ---- ----------------- ------------ ---------------------- T00000X1 L001 ABC 10 CHANGE LOCATION WRH_1 01/01/13 08:00:00 AM T00000X3 L002 XYZ 20 CHANGE LOCATION WRH_3 01/03/13 11:00:00 AM
Kind regards
RobHi, Rob.
Here's one way:
WITH got_r_num AS ( SELECT t.* -- or list columns you want , ROW_NUMBER () OVER ( PARTITION BY lot_no ORDER BY rowversion ) AS r_num FROM transaction_hist_tab t ) SELECT * -- or list all columns except r_num FROM got_r_num WHERE r_num = 1 ;
Depending on your data and your needs, match Sub like Manik suggested, might work. I think that you want to GROUP BY lot_no only, no transid.
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002} -
Query SQL Report with condition (multiple settings) at the point of the apex?
Hi all
I have a small problem and cannot find a solution.
I need to create reports based on a query, SQL or I.R. Nothing hard here.
I need to add the WHERE clause dynamically with javascript to an element of the Apex.
Even once is not very difficult. I set the agenda of the Summit, put my query like this "SELECT * FROM MYTAB WHERE COL1 =: P1_SEARCH" then I call the page by setting the P1_SEARCH value. For example, COL1 is rowid. It works very well.
But here's my problem. Consider that P1_SEARCH contains several ROWID, and I don't know the number of these values,
(no I don't create a large number of items and create a query with so much GOLD!), I would sotheming like "SELECT * FROM MYTAB WHERE ROWID IN (: P1_SEARCH) with something like: ROWID1, ROWID2 in P1_SEARCH."
I also tried: 'ROWID1, ROWID2' and 'ROWID1', 'ROWID2 '.
but I can't get anything else than the mistake of filter. It works with a value, but as soon as there are two values or more, it seems that the Apex is unable to read the string.
How can I do it please?
Thanks for your help.
Maxmnoscars wrote:
But here's my problem. Consider that P1_SEARCH contains several ROWID, and I don't know the number of these values,
(no I don't create a large number of items and create a query with so much GOLD!), I would sotheming like "SELECT * FROM MYTAB WHERE ROWID IN (: P1_SEARCH) with something like: ROWID1, ROWID2 in P1_SEARCH."I also tried: 'ROWID1, ROWID2' and 'ROWID1', 'ROWID2 '.
but I can't get anything else than the mistake of filter. It works with a value, but as soon as there are two values or more, it seems that the Apex is unable to read the string.For a standard report, see + {message identifier: = 9609120} +.
For an IR - and improve safety by avoiding the risk of SQL Injection, use a collection containing the values in a column instead of a CSV list:
{code}
SELECT * FROM MYTAB WHERE ROWID IN (SELECT c001 FROM apex_collections WHERE collection_name = "P1_SEARCH")
{code}
(Please close duplicate threads spawned by your original question.) -
Could not connect to command line SQL Oracle XE
Hello
I use Oracle Xe on windows XP... I can connect to SQLPLUS using the windows shell with each of them to the account user and password as
--------------------------------------------------------------------------------------------------------------
Microsoft Windows XP [Version 5.1.2600]
Copyright (C) 1985-2001 Microsoft Corp.
H:\ > SQLPLUS MAYA/MARCO
SQL * more: Release 10.2.0.1.0 - Production Thu Jun 30 17:28:12 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL >_
---------------------------------------------------------------------------------------------------------------
but when I use the command line SQL Oracle to start-> all programs/Oracle Database 10 g Express Edition / * execute SQL Command Line * it brings the command SQL line with a quick line of SQL, but it connects to the database.
---------------------------------------------------------------------------------------------------------------
SQL * more: Release 10.2.0.1.0 - Production Thu Jun 30 17:36:12 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL > Select * from cat.
SP2-0640: not connected
SQL >
----------------------------------------------------------------------------------------------------------------
and I met with the error "not connected". I'm sure that the database has already started successfully.
Can you please let me know I'm doing wrong or what is problem with Oracle SQL Command Line?
Thank youHello
What is
connect MAYA/MARCO
You can issue a query later?
Kind regards
-
What is this new SQL Beta - 1z1 - 071 - 2 SQL - Oracle Database SQL 12 c
Hello
It's confusing.
This looks like a 2nd review SQL for Oracle 12 c.
What is this new SQL Beta - 1z1 - 071 - 2 SQL - Oracle Database SQL 12 c
Can someone explain.
Roger
OK - I guess I should have held off a few hours before my previous answer. I just got an email in the Certification of Oracle program manager. Now, I have inside information.
1Z0-071 is a SQL new test and the role it plays is between that of the review of databases SQL and SQL Expert. Specifically, unlike review of databases SQL, passing it will give proof of the OCA for people who spend. I don't know more than that yet. The review details page is not available and if the subjects are currently a grey area for me. I'll probably create a blog on the review, if I can get a few details about it.
-
Under Update taking 2 h complete 3000 sets.
UPDATE ARR_TRANSACTIONS ARR
SET = NUMBER99
(SELECT ARR_1.NUMBER99
OF ARR_TRANSACTIONS ARR_1, ARR_HEADER BH
WHERE ARR_1.ARR_ID = BH. ARR_ID
AND BH. FLAG = "Y".
AND ARR_1.LINE_ID = ARR. ORIG_INV_LINE_ID
AND ARR_1.NUMBER9 IS NOT NULL
AND ROWNUM = 1)
WHERE ARR BATCH_ID = 26219
AND ARR. NUMBER99 IS NULL
I added more some condition where to reduce cost and its working fine. But I need to rise more than performance on SQL.
Please help with SQL.
I do not see the number of 3000 lines in the plan - so I guess that the optimizer does not compute with the correct numbers. Could generate the plan with dbms_xplan.display_cursor? This could tell us something about filter predicates and access.
In the given situation, I would check:
- is the access to the index in step 1 (filtered by the relevant conditions: this could be BATCH_ID = 26219) return actually 248 entries (or something similar)?
- Access table in step 2 returning 204 lines (or something similar) after applying the filters given? If the number of lines is much bigger then a Nested Loops is perhaps not a good idea.
To make this much simpler check, you could create a plan with statistics of content (RowSource) given that the plan containing the real and the number of estimated rows.
If the estimated cardinalities are not plausible the next question would be if the statistics are strong and up to date.
-
Hi all
How can I send a query to oracle using cfstoredprod?
Try this:
< datasource = "" #application.dsn # cfstoredproc "procedure =" #importTable #">"
< cfprocparam type = 'in' cfsqltype = "cf_sql_refcursor" value = "#myQuery #" >
< / cfstoredproc >
The Oracle code:
Procedure importTable (v_table IN SYS_REFCURSOR) is
Error: [Oracle JDBC Driver] impossible to determine the type of the specified object.
Any ideas?
Thanks in advance.
Get your drives and put them in a query object (if they aren't already), let's call it getRecs, and:
INSERT ALL INTO schema.tableName(columnA, columnB, columnC, etc) VALUES ( SELECT * FROM DUAL, , , ) You must include the "SELECT * FROM DUAL" after the loop to exit. Connect it to your database (Oracle), insert all the lines and disconnect. Place it in a CFTRANSACTION tag to make sure that they are all inserted or all cancelled.
HTH,
^_^
-
query sql delicate... date of the created object.
friends...
I am trying to solve this query sql delicate for some time, but unable to progress when it comes to this day...
Q.
Query dba_objects and list all tables created yesterday ' sysdate - 1' and in another column of the list all the tables created ' sysdate - 7'.
-query below gives me to yesterday, but don't know how to have 'Last_week' column filled... maybe I join?
appreciate your time and effort in looking at this...select owner, object_name, to_char(created, 'MM-DD-YYYY HH24:MI:SS') "Yesterday", to_char(created, 'MM-DD-YYYY HH24:MI:SS') "Last_Week" from dba_objects where object_type = 'TABLE' and created >=trunc(sysdate - 1) and created < trunc(sysdate)
Thank you
Published by: khallas301 on March 19, 2013 09:27
typo edited... Thanks to frankkhallas301 wrote:
Query dba_objects and list all tables created yesterday ' sysdate - 1' and in another column of the list all the tables created ' sysdate - 7'.Well, sysdate - 7 ways months ago, not last week. If this is what you want, then:
select owner, object_name, case when trunc(created) = trunc(sysdate - 1) then to_char(created,'MM-DD-YYYY HH24:MI:SS') end "Yesterday", case when trunc(created) = trunc(sysdate - 7) then to_char(created, 'MM-DD-YYYY HH24:MI:SS') end "Week Ago" from dba_objects where object_type = 'TABLE' and ( trunc(created) = trunc(sysdate - 1) or trunc(created) = trunc(sysdate - 7) ) /
SY.
Maybe you are looking for
-
You can't find downloaded El Capitan to install?
Downloaded El Capitan and found that I needed more disk space if I free enough space. Now I can not find the download to install it. Tried to download it again, however button store app 'downloaded' say and nothing happens when I click it. Nothing to
-
W7 usb driver for hp15-d000sia
W7 usb driver for hp15-d000sia
-
problem with uninstalling a program
I went to programs and features and a right click on a program to uninstall it, but while it has been uninstalled my computer froze (well, not really freeze, because I could only move my mouse). After 15 minutes, I have the computer shuts down comple
-
How can I find my Micreosofd name & the password of November 2013?
How to find the name and the password of Microsoft gave me in November 2013, I just want to reload Offixw 2013 after pitcher he destroyed on my computer Jim * address email is removed from the privacy *.
-
The application of Sencha Touch menu
I have a Built for BlackBerry app Sencha architect 2, but I can't find any examples how to create a Menu of Application. I read on the developer's Blog that it is possible: http://devblog.blackberry.com/2013/07/sencha-and-blackberry-announce-new-upgr