Query by humming, help!
Hi,
im trying to create an application for a project that allows the user to search for a tune in a databse by humming it.
It currently captures the hummed tune and stores it in an audioinputstream. I'm not sure how to compare the hummed file with the wav file in the database to retrieve it. Do i have to do an FFt on the hummed tune then a spectrum analysis. Any ideas or suggestions would be a great help.
Thanks in advance
Mags
It's going to be highly inaccurate I imagine.
I looked at sound (WAV files) to MIDI conversion programs a while back....
MIDI plays songs as notes.
Eg. play guitar, frequency 1000, duration 1 second...
But once you get multiple instruments playing at once, using more than 1 key at a time (polyphonic) things get ridiculously complicated very fast.
So, programatically, it's near impossible to separate out multiple musical instruments, and voice from the one song / sound input.
Have a look at this web site which gives more information about how difficult a problem this is...
http://www.akoff.com/about.html
If this is a college project I recommend picking something else !
regards,
Owen
Similar Messages
-
Hi experts,
I have one query regarding search help. I have created a elementary search help which is having two fields.Now my requirement is that in the selection screen when I will enter any value in one field and i will press F4 in other field the list should contain only the values corresponding to the first field.
e.g.two fields comp code and name of company. When I will select the company code and press F4 in the second field the companies corresponding to the particular code should appear. Should I write a particular exit for that.
Experts please help me.
I will reward points accordingly.
Thanks in advance,
Abir.hi abir,
no neeed for that.
here i am fetching zones under a country.
so first user enters a country.
eg india.
then on the zone field f4 help, only the zones of india shulod come.
chk how i did it.
*& Form F_GET_ZONE_DESC
THIS SUB ROUTINE WILL FETCH THE ZONE DESCRIPTION
--> p1 F_GET_ZONE_DESC
<-- p2 F_GET_ZONE_DESC
FORM f_get_zone_desc .
CLEAR int_ret.
IF wf_country_code IS INITIAL.
*--MESSAGE IS 'Country Not Selected'.
MESSAGE s016(zm050).
ELSE.
*--THIS WILL FETCH THE ZONE CODES INTO THE INTERNAL TABLE'INT_ZONE_CODE'
*--WITH RESPECT TO A COUNTRY CODE.
SELECT zonecode zone_desc
FROM zmpets_zone
INTO TABLE int_zone_code
WHERE land1 = wf_country_code
AND loekz NE 'X'.
IF sy-subrc NE 0.
*MESSAGE IS 'No Zone Available In <COUNTRY_NAME>
MESSAGE s019(zm050) WITH wf_country_desc.
ELSE.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'WF_ZONE_CODE'
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
value_org = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
value_tab = int_zone_code
FIELD_TAB =
return_tab = int_ret
DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE int_ret INDEX 1." INTO INT_RET.
wf_zone_code = int_ret-fieldval.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " F_GET_ZONE_DESC
rgds
anver
if helped mark points -
Pass username and password ADFS without using query string, Please help.
pass username and password ADFS without using query string, Please help.
I used query string , but it is unsecured to pass credentials over url, with simple tool like httpwatch , anyone can easily get the password and decrypt it.Hi,
According to your post, my understanding is that you had an issue about the ADFS.
As this issue is related to ADFS, I recommend you post your issue to the forum for ADFS.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=Geneva
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
Thank you for your understanding and support.
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jason Guo
TechNet Community Support -
Hi Experts,
I need your help in solving a query about F4 help. I would like to know whether it is possible to return more than one column value from a F4 help. I am working on a scenario where, consider i have a table control with 3 columns. I have F4 helps for two columns. The third column which does not have the F4 help is the primary key and the two columns which have F4 help has repeated values. Consider the following values in the F4 help internal table.
ColumnA ColumnB ColumnC
1 01 10.09.2009
2 01 10.09.2009
3 01 10.09.2009
Now consider the user selects first row '10.09.2009' in ColumnC and selects '01' from first row columnB from F4 help. I need to populate '1' in columnA of table control. For this i am using read statement in PBO of my screen. But the read statement fails since ColumnB and ColumnC have repeated values. Kindly provide a solution to fix this problem. Is it possible to get the row id of the row selected by the user from F4 help? I am using the Fm F4IF_INT_TABLE_VALUE_REQUEST. This Fm returns a return_tab. The return_tab has a field record_pos which is 001 always. So it is of no use. Pls help me with a proper suggestion.
Regards
Rohanhi
if u want an f4 help and get the other values in the row u need to write the code in process on values request.
in PVR
GET CURSOR LINE LINE.
IF TC-TOP_LINE > 1.
LINE = LINE + ( TC-TOP_LINE - 1 ).
ENDIF.
read table itab index line.
in that itab u will get the values . -
Select Query Problem-need help
hi,
Help me out from this problem.
Actually i have a table and the data in it as follows:
Department Name Job Name
Accounts Sr. Accountant
Accounts Jr. Accountant
Accounts Cleark
But i dont want the repeated Department Name.. and i want the same output as follows.
Department Name Job Name
Accounts Sr. Accountant
Jr. Accountant
Cleark
Without using sql reports and Sql Plus additional commands.
The same output should come from a sql query only.
Thanks in Advance
Md Anwer AliI shouldn't try to code before I have had at least three cups of coffee. The actual answer is:
select decode(department,lag(department) over (order by department),null,department)
, job
from departments
order by department.
I ran this:
select decode(job,lag(job) over (order by job),null,job)
, ename
from emp
order by job
and got this result:
SQL> /
DECODE(JO ENAME
ANALYST SCOTT
FORD
CLERK SMITH
ADAMS
MILLER
JAMES
MANAGER JONES
CLARK
BLAKE
PRESIDENT KING
SALESMAN ALLEN
MARTIN
TURNER
WARD
14 rows selected. -
Query Designer: Need help.
Hi All,
This is regarding query issue.
Is this the right forum for this issue or is there a forum for that?
Kindly tell me where should i post this kind of issue.
BTW, below is my issue. I'm finding it hard resolving the defect.
Needs advice on this issue.
The user wants a record for a certain organization.
He/she input all the required parameters.
Let's say:
Business leader ID: XXX01
Begin date: 2010, 2011
End date: 2010, 2011
Status: Active
After executing the report, it returns all of the necessary data records.
But when he click on variable screen or change selection, then changes "ONLY" the Business leader ID.
It goes:
Business leader ID: XXY02
Begin date: 2010, 2011
End date: 2010, 2011
Status: Active
No Applicable Data were returned.
User closes the report the reopen.
He initially entered again with the second ID, parameters now are initially:
Business leader ID: XXY02
Begin date: 2010, 2011
End date: 2010, 2011
Status: Active
Then necessary records were returned.
Question: why is it not returning any data records when he/she change the Business leader ID?
That problem arises only when Business Leader ID was being changed.
But when he/she change selection and change the filter on Begin Date, End Date, Status, the report still provide the data.
The report is not refreshing only when Business Leader ID was being changed.
Thanks!Hi,
You have to check it in your Bex Designer what kind of filter have given report. I think the variable which are user entering the value in the initial screen which may for hard filter.
Open your query in designer and give the details of Variable screen would be very much easy to identify the issue.
Just try this
V1 is the variable for Business leader ID: XXX01
V2 is the variable for Begin date: 2010, 2011
V3 is the variable for End date: 2010, 2011
V4 is the variable for Status: Active
Except V1 variable all can be included in hard filter and Include V1 as restriction.
Hope this will help you to close the issue .. if you need any further assistance , please give the screen shot of your report in bex designer.
Thanks
BVR -
Query Performance Tuning - Help
Hello Experts,
Good Day to all...
TEST@ora10g>select * from v$version;
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
"CORE 10.2.0.4.0 Production"
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production
SELECT fa.user_id,
fa.notation_type,
MAX(fa.created_date) maxDate,
COUNT(*) bk_count
FROM book_notations fa
WHERE fa.user_id IN
( SELECT user_id
FROM
( SELECT /*+ INDEX(f2,FBK_AN_ID_IDX) */ f2.user_id,
MAX(f2.notatn_id) f2_annotation_id
FROM book_notations f2,
title_relation tdpr
WHERE f2.user_id IN ('100002616221644',
'100002616221645',
'100002616221646',
'100002616221647',
'100002616221648')
AND f2.pack_id=tdpr.pack_id
AND tdpr.title_id =93402
GROUP BY f2.user_id
ORDER BY 2 DESC)
WHERE ROWNUM <= 10)
GROUP BY fa.user_id,
fa.notation_type
ORDER BY 3 DESC;Cost of the Query is too much...
Below is the explain plan of the query
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 29 | 1305 | 52 (10)| 00:00:01 |
| 1 | SORT ORDER BY | | 29 | 1305 | 52 (10)| 00:00:01 |
| 2 | HASH GROUP BY | | 29 | 1305 | 52 (10)| 00:00:01 |
| 3 | TABLE ACCESS BY INDEX ROWID | book_notations | 11 | 319 | 4 (0)| 00:00:01 |
| 4 | NESTED LOOPS | | 53 | 2385 | 50 (6)| 00:00:01 |
| 5 | VIEW | VW_NSO_1 | 5 | 80 | 29 (7)| 00:00:01 |
| 6 | HASH UNIQUE | | 5 | 80 | | |
|* 7 | COUNT STOPKEY | | | | | |
| 8 | VIEW | | 5 | 80 | 29 (7)| 00:00:01 |
|* 9 | SORT ORDER BY STOPKEY | | 5 | 180 | 29 (7)| 00:00:01 |
| 10 | HASH GROUP BY | | 5 | 180 | 29 (7)| 00:00:01 |
| 11 | TABLE ACCESS BY INDEX ROWID | book_notations | 5356 | 135K| 26 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 6917 | 243K| 27 (0)| 00:00:01 |
| 13 | MAT_VIEW ACCESS BY INDEX ROWID| title_relation | 1 | 10 | 1 (0)| 00:00:01 |
|* 14 | INDEX RANGE SCAN | IDX_TITLE_ID | 1 | | 1 (0)| 00:00:01 |
| 15 | INLIST ITERATOR | | | | | |
|* 16 | INDEX RANGE SCAN | FBK_AN_ID_IDX | 5356 | | 4 (0)| 00:00:01 |
|* 17 | INDEX RANGE SCAN | FBK_AN_ID_IDX | 746 | | 1 (0)| 00:00:01 |
Table Details
SELECT COUNT(*) FROM book_notations; --111367
Columns
user_id -- nullable field - VARCHAR2(50 BYTE)
pack_id -- NOT NULL --NUMBER
notation_type-- VARCHAR2(50 BYTE) -- nullable field
CREATED_DATE - DATE -- nullable field
notatn_id - VARCHAR2(50 BYTE) -- nullable field
Index
FBK_AN_ID_IDX - Non unique - Composite columns --> (user_id and pack_id)
SELECT COUNT(*) FROM title_relation; --12678
Columns
pack_id - not null - number(38) - PK
title_id - not null - number(38)
Index
IDX_TITLE_ID - Non Unique - TITLE_ID
Please help...
Thanks...Linus wrote:
Thanks Bravid for your reply; highly appreciate that.
So as you say; index creation on the NULL column doesnt have any impact. OK fine.
What happens to the execution plan, performance and the stats when you remove the index hint?
Find below the Execution Plan and Predicate information
"PLAN_TABLE_OUTPUT"
"Plan hash value: 126058086"
"| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |"
"| 0 | SELECT STATEMENT | | 25 | 1125 | 55 (11)| 00:00:01 |"
"| 1 | SORT ORDER BY | | 25 | 1125 | 55 (11)| 00:00:01 |"
"| 2 | HASH GROUP BY | | 25 | 1125 | 55 (11)| 00:00:01 |"
"| 3 | TABLE ACCESS BY INDEX ROWID | book_notations | 10 | 290 | 4 (0)| 00:00:01 |"
"| 4 | NESTED LOOPS | | 50 | 2250 | 53 (8)| 00:00:01 |"
"| 5 | VIEW | VW_NSO_1 | 5 | 80 | 32 (10)| 00:00:01 |"
"| 6 | HASH UNIQUE | | 5 | 80 | | |"
"|* 7 | COUNT STOPKEY | | | | | |"
"| 8 | VIEW | | 5 | 80 | 32 (10)| 00:00:01 |"
"|* 9 | SORT ORDER BY STOPKEY | | 5 | 180 | 32 (10)| 00:00:01 |"
"| 10 | HASH GROUP BY | | 5 | 180 | 32 (10)| 00:00:01 |"
"| 11 | TABLE ACCESS BY INDEX ROWID | book_notations | 5875 | 149K| 28 (0)| 00:00:01 |"
"| 12 | NESTED LOOPS | | 7587 | 266K| 29 (0)| 00:00:01 |"
"| 13 | MAT_VIEW ACCESS BY INDEX ROWID| title_relation | 1 | 10 | 1 (0)| 00:00:01 |"
"|* 14 | INDEX RANGE SCAN | IDX_TITLE_ID | 1 | | 1 (0)| 00:00:01 |"
"| 15 | INLIST ITERATOR | | | | | |"
"|* 16 | INDEX RANGE SCAN | FBK_AN_ID_IDX | 5875 | | 4 (0)| 00:00:01 |"
"|* 17 | INDEX RANGE SCAN | FBK_AN_ID_IDX | 775 | | 1 (0)| 00:00:01 |"
"Predicate Information (identified by operation id):"
" 7 - filter(ROWNUM<=10)"
" 9 - filter(ROWNUM<=10)"
" 14 - access(""TDPR"".""TITLE_ID""=93402)"
" 16 - access((""F2"".""USER_ID""='100002616221644' OR ""F2"".""USER_ID""='100002616221645' OR "
" ""F2"".""USER_ID""='100002616221646' OR ""F2"".""USER_ID""='100002616221647' OR "
" ""F2"".""USER_ID""='100002616221648') AND ""F2"".""PACK_ID""=""TDPR"".""PACK_ID"")"
" 17 - access(""FA"".""USER_ID""=""$nso_col_1"")"
The cost is the same because the plan is the same. The optimiser chose to use that index anyway. The point is, now that you have removed it, the optimiser is free to choose other indexes or a full table scan if it wants to.
>
Statistics
BEGIN
DBMS_STATS.GATHER_TABLE_STATS ('TEST', 'BOOK_NOTATIONS');
END;
"COLUMN_NAME" "NUM_DISTINCT" "NUM_BUCKETS" "HISTOGRAM"
"NOTATION_ID" 110269 1 "NONE"
"USER_ID" 213 212 "FREQUENCY"
"PACK_ID" 20 20 "FREQUENCY"
"NOTATION_TYPE" 8 8 "FREQUENCY"
"CREATED_DATE" 87 87 "FREQUENCY"
"CREATED_BY" 1 1 "NONE"
"UPDATED_DATE" 2 1 "NONE"
"UPDATED_BY" 2 1 "NONE"
After removing the hint ; the query still shows the same "COST"
Autotrace
recursive calls 1
db block gets 0
consistent gets 34706
physical reads 0
redo size 0
bytes sent via SQL*Net to client 964
bytes received via SQL*Net from client 1638
SQL*Net roundtrips to/from client 2
sorts (memory) 3
sorts (disk) 0
Output of query
"USER_ID" "NOTATION_TYPE" "MAXDATE" "COUNT"
"100002616221647" "WTF" 08-SEP-11 20000
"100002616221645" "LOL" 08-SEP-11 20000
"100002616221644" "OMG" 08-SEP-11 20000
"100002616221648" "ABC" 08-SEP-11 20000
"100002616221646" "MEH" 08-SEP-11 20000Thanks...I still don't know what we're working towards at the moment. WHat is the current run time? What is the expected run time?
I can't tell you if there's a better way to write this query or if indeed there is another way to write this query because I don't know what it is attempting to achieve.
I can see that you're accessing 100k rows from a 110k row table and it's using an index to look those rows up. That seems like a job for a full table scan rather than index lookups.
David -
Access SQL Query Problem - Pls help
Hi,
I'm connecting to an Access database and have a query which looks somehting like this:
SELECT Accept.ACCEPT_NO,
Accept.CURRENCY,
Accept.INT_RATE,
Accept.F_AMOUNT,
Accept.DEALER,
Accept.MATURITY,
Accept.START_DATE,
Accept.DEAL_DATE,
Accept.DEALTICKET,
Accept.BANK_NAME,
Accept.CALC_DAYS,
"2001/11/22" AS CurrentDate
FROM Accept;
It works fine without the line with CurrentDate so i'm sure something's wrong there. What i want to do is set CurrentDate as a constant ("2001/11/22") i dont have any experience with Access so any help you could give me would be greatly appreciated.
Thanx in advance.I was able to successfully query an access 97 database using the following SQL:
String sql = "SELECT emp.emp_fname, emp.emp_lname, '2001/11/22' AS CurrentDate FROM emp";don't know why your's wouldn't work. Was there a SQLException? Or are you trying to get it to work using the Access SQL editor?
Jamie -
Query using binding help?!?!
I am fairly new to the world of SQL and I am having a problem with a query using binding. I am using SQL Developer (3.1.07).
If I run the query with no bindings, everything works fine. On normal occasions I run this query on the day I want my totals and I achieve my desired results:
SELECT SA.CRAFT,nvl(SUM (SA.LABORHRS),0) as "Loaded Hours"
FROM SOL_SCHEDULEBASELINEWOASGMNT SA
LEFT JOIN SOL_SCHEDULEBASELINE SB ON SB.BASELINEID = SA.BASELINEID
WHERE SB.DATECODE = 'DAILY'
AND TO_CHAR(SB.FROMDATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
AND TO_CHAR(SB.TODATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
AND TO_CHAR(SA.SCHEDULEDATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
group by sa.craft
order by sa.craft asc
CRAFT Loaded Hours
CONTR. 24
MM 12
MT 6
BUT* I want to be able to enter my own date instead of using sysdate. This will be for if I miss running this for a day, am asked for the values from a previous date, etc...
The value will always be the same date for all three date fields(SB.FROMDATE,SB.TODATE,SA.SCHEDULEDATE)
I've modified the query to here and the query still works great at this stage: (I'm using 01-APR-2012 in my binding...)
SELECT SA.CRAFT,nvl(SUM (SA.LABORHRS),0) as "Loaded Hours"
FROM SOL_SCHEDULEBASELINEWOASGMNT SA
LEFT JOIN SOL_SCHEDULEBASELINE SB ON SB.BASELINEID = SA.BASELINEID
WHERE SB.DATECODE = 'DAILY'
AND SB.FROMDATE = :DDMONYYYY
AND SB.TODATE = :DDMONYYYY
AND TO_CHAR(SA.SCHEDULEDATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
group by sa.craft
order by sa.craft asc
CRAFT Loaded Hours
CONTR. 24
MM 12
MT 6
The instant I change my query to the following I get a different result:
SELECT SA.CRAFT,nvl(SUM (SA.LABORHRS),0) as "Loaded Hours"
FROM SOL_SCHEDULEBASELINEWOASGMNT SA
LEFT JOIN SOL_SCHEDULEBASELINE SB ON SB.BASELINEID = SA.BASELINEID
WHERE SB.DATECODE = 'DAILY'
AND SB.FROMDATE = :DDMONYYYY
AND SB.TODATE = :DDMONYYYY
AND SA.SCHEDULEDATE = :DDMONYYYY
group by sa.craft
order by sa.craft asc
CRAFT Loaded Hours
CONTR. 10
All columns have a data_type of Date.
As soon as I change SA.SCHEDULEDATE from
AND TO_CHAR(SA.SCHEDULEDATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
to
SA.SCHEDULEDATE = :DDMMYYYY
it stops returning the results I need.
Why is this? Does anyone have an idea of what is going on here? Any help would be GREATLY appreciated!
Thank YouCook wrote:
I am fairly new to the world of SQL and I am having a problem with a query using binding. I am using SQL Developer (3.1.07).
If I run the query with no bindings, everything works fine. On normal occasions I run this query on the day I want my totals and I achieve my desired results:
SELECT SA.CRAFT,nvl(SUM (SA.LABORHRS),0) as "Loaded Hours"
FROM SOL_SCHEDULEBASELINEWOASGMNT SA
LEFT JOIN SOL_SCHEDULEBASELINE SB ON SB.BASELINEID = SA.BASELINEID
WHERE SB.DATECODE = 'DAILY'
AND TO_CHAR(SB.FROMDATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
AND TO_CHAR(SB.TODATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
AND TO_CHAR(SA.SCHEDULEDATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
group by sa.craft
order by sa.craft asc
CRAFT Loaded Hours
CONTR. 24
MM 12
MT 6
BUT* I want to be able to enter my own date instead of using sysdate. This will be for if I miss running this for a day, am asked for the values from a previous date, etc...
The value will always be the same date for all three date fields(SB.FROMDATE,SB.TODATE,SA.SCHEDULEDATE)
I've modified the query to here and the query still works great at this stage: (I'm using 01-APR-2012 in my binding...)
SELECT SA.CRAFT,nvl(SUM (SA.LABORHRS),0) as "Loaded Hours"
FROM SOL_SCHEDULEBASELINEWOASGMNT SA
LEFT JOIN SOL_SCHEDULEBASELINE SB ON SB.BASELINEID = SA.BASELINEID
WHERE SB.DATECODE = 'DAILY'
AND SB.FROMDATE = :DDMONYYYY
AND SB.TODATE = :DDMONYYYY
AND TO_CHAR(SA.SCHEDULEDATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
group by sa.craft
order by sa.craft asc
CRAFT Loaded Hours
CONTR. 24
MM 12
MT 6
The instant I change my query to the following I get a different result:
SELECT SA.CRAFT,nvl(SUM (SA.LABORHRS),0) as "Loaded Hours"
FROM SOL_SCHEDULEBASELINEWOASGMNT SA
LEFT JOIN SOL_SCHEDULEBASELINE SB ON SB.BASELINEID = SA.BASELINEID
WHERE SB.DATECODE = 'DAILY'
AND SB.FROMDATE = :DDMONYYYY
AND SB.TODATE = :DDMONYYYY
AND SA.SCHEDULEDATE = :DDMONYYYY
group by sa.craft
order by sa.craft asc
CRAFT Loaded Hours
CONTR. 10
All columns have a data_type of Date.
As soon as I change SA.SCHEDULEDATE from
AND TO_CHAR(SA.SCHEDULEDATE, 'DD-MON-YYYY') = TO_CHAR(SYSDATE, 'DD-MON-YYYY')
to
SA.SCHEDULEDATE = :DDMMYYYY
it stops returning the results I need.
Why is this? Does anyone have an idea of what is going on here? Any help would be GREATLY appreciated!
Thank YouWhat are the datatypes involved?
It is likely that you are being impacted by implicit datatype conversion.
Realize that you can only enter strings; so you need to use TO_DATE() to convert string to DATE. -
Hello All,
I'm having problems trying to format the output of one of my queries. I'm new to SQL and I consider my writing the query a HUGE win.... but I can't seem to get the correct output format.
Per the code below, it is outputting the Last Name (lname) of the employee, a count of what I want, and the overall rank. I would like to concatenate the employee number (emp#) the first (fname) and last name (lname) together into the same column in the output.
The concatenation code would be something like the below.
Desired concatenation:
emp# || ' - ' || lname || ', ' || fname AS EMPLOYEE
I'm using Oracle 11g Express. Please let me know if you need any supporting information to assist you.
I appreciate all your help!!! Thank you.
Query
SELECT EMPLOYEE, PREPARED,
RANK() OVER (ORDER BY Prepared DESC) AS rank
FROM (SELECT lname EMPLOYEE , COUNT(DISTINCT reportnum) PREPARED
FROM employee
LEFT OUTER JOIN faultreport USING (empno)
GROUP BY lname
ORDER BY Prepared DESC)
WHERE rownum < 15;Hi,
8bb7968b-e6ae-456c-8459-f418352e9e0a wrote:
Hello All,
I'm having problems trying to format the output of one of my queries. I'm new to SQL and I consider my writing the query a HUGE win.... but I can't seem to get the correct output format.
Per the code below, it is outputting the Last Name (lname) of the employee, a count of what I want, and the overall rank. I would like to concatenate the employee number (emp#) the first (fname) and last name (lname) together into the same column in the output.
The concatenation code would be something like the below.
Desired concatenation:
emp# || ' - ' || lname || ', ' || fname AS EMPLOYEE
I'm using Oracle 11g Express. Please let me know if you need any supporting information to assist you.
Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
I appreciate all your help!!! Thank you.
Query
SELECT EMPLOYEE, PREPARED,
RANK() OVER (ORDER BY Prepared DESC) AS rank
FROM (SELECT lname EMPLOYEE , COUNT(DISTINCT reportnum) PREPARED
FROM employee
LEFT OUTER JOIN faultreport USING (empno)
GROUP BY lname
ORDER BY Prepared DESC)
WHERE rownum < 15;
It looks like you've found the right way to concatenate the columns. How to use that in your query depends on your data, and what you want the query to do with that data.
If you GROUP BY lname, what do you want the concatenated value to be when different rows having the same lname have different fnames and/or emp#s?
Do you want to GROUP BY the new concatenated employee instead of lname? -
Hi can any body tell me how do I improve the performance of this query.This query takes forever to execute.
PLEASE HELP
select substr(d.name,1,14) "dist",
sum(r.room_net_sq_foot) "nsf",
sum(r.student_station_count) "sta",
sum(distinct(r.cofte)) "fte"
from b_fish_report r,
g_efis_organization d
where substr(r.organization_code,-2,2) = substr(d.code,-2,2) and
d.organization_type = 'CNTY' and
r.room_satisfactory_flag = 'Y' and
substr(d.code,-2,2) between '01' and '72'
-- rownum < 50
group by d.name, r.organization_code
order by d.name
It has nonunique Indexes on Organization code
Thanks
Asma.Asma,
I tried your SQL on my tables T1 and T2. Indexes are on C1,C2,C3 and N1,N2,N3. The data in T1 and T2 are shown below with the explain plan (also called EP) listed. You really need to do an explain plan (free TOAD is easiest to do this in) and respond showing your EP results.
By simply changing the optimizer mode to RULE I was able to get it to use indexes on both T1 and T2.
T1 data
C1 C2 C3 N1 N2
001 Y AAA 1 11
002 Y BBB 2 22
003 Y CCC 3 33
111 N DDD 4 44
222 N EEE 5 55
333 Y FFF 6 66
070 Y GGG 7 77
071 N HHH 8 88
072 Y III 9 99
TEST TEST TEST 10 100
T2 data
C1 C2 C3 N1 N2
001 CNTY AAA 1 11
002 CNTY BBB 2 22
003 CNTY CCC 3 33
111 XXX DDD 4 44
222 XXX EEE 5 55
333 CNTY FFF 6 66
070 CNTY GGG 7 77
071 XXX HHH 8 88
072 CNTY III 9 99
TEST TEST TEST 10 100
This is the results when I run the SQL based on this data ...
dist nsf sta fte
AAA 1 11 10
BBB 2 22 20
CCC 3 33 30
FFF 6 66 60
GGG 7 77 70
III 9 99 90
--[SQL 1] : with CHOOSE as the optimizer mode, which is normally the DEFAULT if no hint is specified
select /*+ CHOOSE */
substr(d.c3,1,14) "dist",
sum(r.n1) "nsf",
sum(r.n2) "sta",
sum(distinct(r.n3)) "fte"
from t1 r, t2 d
where substr(r.c1,-2,2) = substr(d.c1,-2,2) and
d.c2 = 'CNTY' and
r.c2 = 'Y' and
substr(d.c1,-2,2) between '01' and '72'
group by d.c3, r.c1
order by d.c3
This is what the EP shows for your SQL (which will probably be the same for you once you do an EP on your actuall sql) ...
SELECT STATEMENT Optimizer=CHOOSE (Cost=4 Card=1 Bytes=37)
SORT (GROUP BY) (Cost=4 Card=1 Bytes=37)
NESTED LOOPS (Cost=2 Card=1 Bytes=37)
TABLE ACCESS (FULL) OF T1 (Cost=1 Card=1 Bytes=12)
TABLE ACCESS (BY INDEX ROWID) OF T2 (Cost=1 Card=1 Bytes=25)
INDEX (RANGE SCAN) OF I_NU_T2_C2 (NON-UNIQUE)
Notice the FULL table scan of T1 which you don't want, and neither C1 index is getting used (I've explained why below).
--[SQL 2] : only changed the hint to RULE ...
select /*+ RULE */
substr(d.c3,1,14) "dist",
sum(r.n1) "nsf",
sum(r.n2) "sta",
sum(distinct(r.n3)) "fte"
from t1 r, t2 d
where substr(r.c1,-2,2) = substr(d.c1,-2,2) and
d.c2 = 'CNTY' and
r.c2 = 'Y' and
substr(d.c1,-2,2) between '01' and '72'
group by d.c3, r.c1
order by d.c3
SELECT STATEMENT Optimizer=HINT: RULE
SORT (GROUP BY)
NESTED LOOPS
TABLE ACCESS (BY INDEX ROWID) OF T2
INDEX (RANGE SCAN) OF I_NU_T2_C2 (NON-UNIQUE)
TABLE ACCESS (BY INDEX ROWID) OF T1
INDEX (RANGE SCAN) OF I_NU_T1_C2 (NON-UNIQUE)
Though the C2 index is getting used (your r.c2 = 'Y' part in the where clause) the main problem your having here is the JOIN column (C1 in both tables) is not getting used. So the join you have ...
where substr(r.c1,-2,2) = substr(d.c1,-2,2)
isn't using an index and you want it too. There are 2 solutions to correct this..
Solution #1
The first is to make a function-based index for data. Since your doing SUBSTR on C1 that C1 index does not contain that partial information so it will not use it. Below is the syntax to make a function based index for this partial data ...
CREATE INDEX I_NU_T1_C1_SUBSTR ON T1 (SUBSTR(C1,-2,2));
CREATE INDEX I_NU_T2_C1_SUBSTR ON T2 (SUBSTR(C1,-2,2));
or also this way if it's still not using the above indexes ...
CREATE INDEX I_NU_T1_C1_SUBSTR ON T1 (SUBSTR(C1,-2,2),C1);
CREATE INDEX I_NU_T2_C1_SUBSTR ON T2 (SUBSTR(C1,-2,2),C1);
Solution #2
The second solution is to make another column in both table and place this 2 digit information in it, and then index this new column. That way the join will look like ...
where r.c_new_column = d.c_new_column
and
r.c_new_column between '01' and '72'
also with this new column the BETWEEN clause at the end you will not need the substring as well. Also remember BETWEEN on character values is different than numbers.
Final Notes
I just tried creating the functional index and I can't get it to be used it for some reason (I might not have the right amount of data), but I really think that is your best option here. As long as it uses the functional index you won't have to change your code. You might want to try using INDEX() in the hint to get it to be used, but hopefully it will use it right away. Try all 4 types of optimizer modes (CHOOSE, RULE, ALL_ROWS, FIRST_ROWS) in your primary hints to see if it will use the new function-based index.
You really do need to get explain plan going. Even if you make these functional indexes you won't know if its going to be using them until you look at the EP results. You can do EP manually (the SQL of how to produce the results is in OTN, though I find free TOAD is by far the easiest) and you will still need to have run the utlxplan.sql script. Oracle I do think has some GUI tools, maybe in OEM, that have explain plan built in as well.
I hope this helps ya,
Tyler D. -
Hello Experts,
Please help me how the table "digital_compatibility" be modified for faster performance?
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.1.0 - Productio
NLSRTL Version 10.2.0.1.0 - Production
Count of records for the tables:-
SELECT count(*) FROM DEVICE_TYPE; --421
SELECT count(*) FROM DIGITAL_COMPATIBILITY; --227757
CREATE TABLE DEVICE_TYPE
DEVICE_TYPE_ID NUMBER(38,0),
DEVICE_TYPE_MAKE VARCHAR2(256 BYTE),
DEVICE_TYPE_MODEL VARCHAR2(256 BYTE),
DEVICE_DISPLAY_NAME VARCHAR2(256 BYTE),
PARTNER_DEVICE_TYPE VARCHAR2(256 BYTE),
DEVICE_IMAGE_URL VARCHAR2(256 BYTE),
FOH_BUTTON_NAME VARCHAR2(256 BYTE),
FOH_ACTIVE_FLAG CHAR(1 BYTE),
BB_RETAIL_FLAG CHAR(1 BYTE),
DISPLAY_DESCRIPTION VARCHAR2(256 BYTE),
DEVICE_CATEGORY_ID NUMBER(38,0),
DEVICE_SUB_CATEGORY_ID NUMBER(38,0),
DEVICE_BRAND_ID NUMBER(38,0),
PARENT_ID NUMBER(38,0),
POWERED_BY VARCHAR2(256 BYTE),
CARRIER VARCHAR2(256 BYTE),
CAPABILITY_SET_ID NUMBER(38,0),
CREATED_BY VARCHAR2(32 BYTE),
CREATED_DATE DATE,
UPDATED_BY VARCHAR2(32 BYTE),
UPDATED_DATE DATE,
POWERED_BY_DEVICE_TYPE VARCHAR2(64 BYTE),
OPERATING_SYSTEM VARCHAR2(32 BYTE),
OPERATING_SYSTEM_VERSION VARCHAR2(32 BYTE),
BROWSER VARCHAR2(32 BYTE),
BROWSER_VERSION VARCHAR2(32 BYTE),
CLASSIFICATION VARCHAR2(32 BYTE),
CONSTRAINT PK_DEVICE_TYPE PRIMARY KEY ( DEVICE_TYPE_ID));
CREATE INDEX DEVICE_TYPE_IDX ON DEVICE_TYPE
CAPABILITY_SET_ID ,
UPPER( PARTNER_DEVICE_TYPE )
CREATE TABLE DIGITAL_COMPATIBILITY
DIGITAL_COMPATIBILITY_ID NUMBER NOT NULL ENABLE,
CAPABILITY_SET_ID NUMBER,
OBJECT_TYPE VARCHAR2(38 BYTE) NOT NULL ENABLE,
CREATED_DATE DATE NOT NULL ENABLE,
CREATED_BY VARCHAR2(38 BYTE) NOT NULL ENABLE,
UPDATED_DATE DATE NOT NULL ENABLE,
UPDATED_BY VARCHAR2(38 BYTE) NOT NULL ENABLE,
OBJECT_ID VARCHAR2(114 BYTE),
ENCODE_PROFILE_ID NUMBER
CREATE INDEX ENCODE_PROFILE_ID_IDX ON DIGITAL_COMPATIBILITY
ENCODE_PROFILE_ID,
OBJECT_ID,
OBJECT_TYPE
Query
=====
EXPLAIN PLAN FOR
SELECT /*+ INDEX(dc, ENCODE_PROFILE_ID_IDX) */
DISTINCT dc.object_id AS title_id
FROM digital_compatibility dc,
device_type dt
WHERE dc.capability_set_id = dt.capability_set_id
AND upper(dt.partner_device_type) = :1
AND dc.object_id IN (:2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23, :24, :25, :26, :27, :28, :29, :30, :31, :32, :33)
AND dc.object_type =:"SYS_B_0";
Explain plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 2 | 472 | 274 (4)|
| 1 | HASH UNIQUE | | 2 | 472 | 274 (4)|
|* 2 | MAT_VIEW ACCESS BY INDEX ROWID| DIGITAL_COMPATIBILITY | 1 | 93 | 68 (3)|
| 3 | NESTED LOOPS | | 2 | 472 | 273 (4)|
|* 4 | INDEX FULL SCAN | DEVICE_TYPE_IDX | 4 | 572 | 1 (0)|
|* 5 | INDEX FULL SCAN | ENCODE_PROFILE_ID_IDX | 8 | | 67 (3)|
Predicate Information (identified by operation id):
2 - filter("DC"."CAPABILITY_SET_ID"="DT"."CAPABILITY_SET_ID")
4 - access(UPPER("PARTNER_DEVICE_TYPE")=:1)
filter(UPPER("PARTNER_DEVICE_TYPE")=:1)
5 - access("DC"."OBJECT_TYPE"=:SYS_B_0)
filter(("DC"."OBJECT_ID"=:2 OR "DC"."OBJECT_ID"=:3 OR "DC"."OBJECT_ID"=:4 OR
"DC"."OBJECT_ID"=:5 OR "DC"."OBJECT_ID"=:6 OR "DC"."OBJECT_ID"=:7 OR
"DC"."OBJECT_ID"=:8 OR "DC"."OBJECT_ID"=:9 OR "DC"."OBJECT_ID"=:10 OR
"DC"."OBJECT_ID"=:11 OR "DC"."OBJECT_ID"=:12 OR "DC"."OBJECT_ID"=:13 OR
"DC"."OBJECT_ID"=:14 OR "DC"."OBJECT_ID"=:15 OR "DC"."OBJECT_ID"=:16 OR
"DC"."OBJECT_ID"=:17 OR "DC"."OBJECT_ID"=:18 OR "DC"."OBJECT_ID"=:19 OR
"DC"."OBJECT_ID"=:20 OR "DC"."OBJECT_ID"=:21 OR "DC"."OBJECT_ID"=:22 OR
"DC"."OBJECT_ID"=:23 OR "DC"."OBJECT_ID"=:24 OR "DC"."OBJECT_ID"=:25 OR
"DC"."OBJECT_ID"=:26 OR "DC"."OBJECT_ID"=:27 OR "DC"."OBJECT_ID"=:28 OR
"DC"."OBJECT_ID"=:29 OR "DC"."OBJECT_ID"=:30 OR "DC"."OBJECT_ID"=:31 OR
"DC"."OBJECT_ID"=:32 OR "DC"."OBJECT_ID"=:33) AND "DC"."OBJECT_TYPE"=:SYS_B_0)
Note
- 'PLAN_TABLE' is old version
Trace
recursive calls 280
db block gets 16
consistent gets 97
physical reads 0
redo size 3224
bytes sent via SQL*Net to client 589
bytes received via SQL*Net from client 1598
SQL*Net roundtrips to/from client 2
sorts (memory) 4
sorts (disk) 0
Thanks ....You index on DIGITAL_COMPATIBILITY is on ENCODE_PROFILE_ID, OBJECT_ID, OBJECT_TYPE
But you query for object_id and object_type.
How much rows you you identify with this? What the PK?
The way it's now, it needs to read the full index, then the table and as DEVICE_TYPE is small it makes a NL to it.
Makes sense.
If you would add an index on OBJECT_ID, OBJECT_TYPE and capability_set_id ORACLE would just need to read the INDEX. -
Hi
I am executing a query:
select vetno,category from vetno where vetno.category IN (select decode (REP_VET_CATG,NULL,'('A','B')','REP_VET_CATG') from dual);
The REP_VET_CATG variable takes the value from the GUI.
I want the functionality such that if it is NULL then the query should be
select vetno,category from vetno where vetno.category IN ('A','B');
else
Take the values that is passed i.e the query should be like this
select vetno,category from vetno where vetno.category = 'REP_VET_CATG';
I tried the above query but it gives me a error missing right paranthesis.
Can anyone help ......with this OR suggest a better alternative..Do you mean this?
SQL> create table vetno
2 as
3 select 1 vetno, 'A' category from dual union all
4 select 2, 'B' from dual union all
5 select 3, 'C' from dual
6 /
Tabel is aangemaakt.
SQL> var REP_VET_CATG varchar2(1)
SQL> exec :REP_VET_CATG := null
PL/SQL-procedure is geslaagd.
SQL> select vetno
2 , category
3 from vetno
4 where ( :REP_VET_CATG is null
5 and vetno.category in ('A','B')
6 )
7 or ( :REP_VET_CATG is not null
8 and vetno.category = :REP_VET_CATG
9 )
10 /
VETNO C
1 A
2 B
2 rijen zijn geselecteerd.
SQL> exec :REP_VET_CATG := 'C'
PL/SQL-procedure is geslaagd.
SQL> select vetno
2 , category
3 from vetno
4 where ( :REP_VET_CATG is null
5 and vetno.category in ('A','B')
6 )
7 or ( :REP_VET_CATG is not null
8 and vetno.category = :REP_VET_CATG
9 )
10 /
VETNO C
3 C
1 rij is geselecteerd.Regards,
Rob. -
ABAP QUERY REPORT : please help me ASAP.
hi friends,
I need to change the existing custom abap query.
1) I need to add two more fields on selection screen. I have added using INFOSET and checked the input and output check boxes.
But the text of the one field should be different from standard tetx.
"Reference date" to be changed to "Dairy date".
I have changed in Infosets. updated text is displaying as "Dairy date" in the out put LIST, but standard text (Reference date) is appearing on the selection screen.
I need it to be displaed as "Dairy date"
2)The column "Dairy" date is adding as the last column in the list after executing the query. But I need it to be displayed at 8th column.
Please help me ASAP.hi Eric,
Could you please explain in detail.
1)I HAVE CHANGED THE NAME IN iNFOSET, FIELD GROUP.
IT IS NOT REFLECTING IN SELECTION SCREEN. ONLY REFLECTING IN THE OUT PUT.
2) I have tried by changing the sort sequence number. but still it is displaying at the end of the columns.
please explain in detail. -
Howto read url query string? Help :(
Hi everyone, I am trying to read the query string from within an applet loaded from a URL. I am loading netscape with the following URL
"http://localhost/mypage.html?param1=help"
I am using code:
System.out.println(getDocumentBase().getQuery());
and all I am getting is a null?
This works with appletviewer so could someone tell me what is going on. I have searched the forum but it seems no answer yet exists for this. Perhaps its not possible?
Info:
OS: Redhat Linux 8
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)hi,
can it be that there is a problem with netscape?
it would suggest to try on ie, but you use linux and i dont think theres an ie-version for linux available ;P
i would try it on a different browser like opera or something.
thats my suggestion.
hope this helped
cu Errraddicator
Maybe you are looking for
-
My HD failed and I need to replace it but I'm not sure how
My portege M780 keeps crashing after the hard drive makes grunting and clicking noises. I ordered a new hard drive (the exact same model as the one the portege has right now), but I'm wondering how I'll be able to get Windows 7 and all the Toshiba dr
-
Detailed Source System Analysis
Hi I am a new bie to this community and am trying to learn things as much as I can asap. :) I am looking for any standard templates available for a detailed "source system analysis". We are trying to put that into practice on two systems that we are
-
Exception class: RFC not found
Hi, Do you know whether there is an exception class in web dynpro java that i can catch in case the RFC is not found in the backend system? Thanks and regards, Nada
-
Keynote exporting to FLASH will not run on browsers
I have created several short keynote files that were then exported to Flash so that they can be viewed on an HTML page created by dreameweaver. However, after exporting them to a swf file and then importing the flash file into an html page all I get
-
I am doing project I want some file in format which will not make sense to anyone who opens file. I have seen many java application which has .bin .bok etc format. How to do that Please suggest me.