Select from from T1,T2
Hi,
Can anybody help me how to explain this select on those 2 tables, I'm stuck with line #3, marked with "xxx", is it just for JOIN, no columns select but T2 brought into Select for further predicate evaluation?
This is piece of one example, where we have to to filter only those records from first table where all sub_item_cd exists in second table, ie.
item_cd
1010
1012
But it doesn't matter for this question, just trying to digest logic of this Select. I can see that even output for lines1,2,3 produce some cortesian product that I can't explain.
Tx all
T
select t1.item_cd ----- #1
from t1, ------#2
(select distinct sub_item_cd from t2 ) t2 --------#3/* xxx */
where t1.sub_item_cd = t2.sub_item_cd(+) --------#4
group by t1.item_cd --------#5
having max(decode( t2.sub_item_cd, NULL, 1, 0 )) = 0 ---------#6
T1::::
item_cd sub_item_cd
1010 A
1010 B
1010 C
1011 A
1011 D --/* D not in T2
1012 A
T2::::
sub_item_cd
A
A
A
B
B
C
B
C
Hi,
trento wrote:
Hi,
Can anybody help me how to explain this select on those 2 tables, I'm stuck with line #3, marked with "xxx", is it just for JOIN, no columns select but T2 brought into Select for further predicate evaluation?
This is piece of one example, where we have to to filter only those records from first table where all sub_item_cd exists in second table, ie.
item_cd
1010
1012
But it doesn't matter for this question, just trying to digest logic of this Select. I can see that even output for lines1,2,3 produce some cortesian product that I can't explain.
select t1.item_cd ----- #1
from t1, ------#2
(select distinct sub_item_cd from t2 ) t2 --------#3/* xxx */
where t1.sub_item_cd = t2.sub_item_cd(+) --------#4
group by t1.item_cd --------#5
having max(decode( t2.sub_item_cd, NULL, 1, 0 )) = 0 ---------#6
Line #3 contains an In-Line View , where the result set of that sub-query is used as a table. When "t2" is referenced elsewhere (lines #4 and #6) it is the sub-query called t2, not the table with the same name, that is being referenced. (By the way, it's confusing to use the a column alias that's the same as a table name in the same query.)
As Marcus said, there's no point in using a sub-query in this case; you might as well use the raw t2 table.
I find the use of MAX and DECODE in the HAVING clause to be confusing. I think a better way to get the same results is:
SELECT t1.item_cd
FROM t1
, t2
WHERE t1.sub_item_cd = t2.sub_item_cd (+)
GROUP BY t1.item_cd
HAVING COUNT (*) = COUNT (t2.sub_item_cd)
;I don't follow what you're saying about a Cartesian product. A Cartesian Product (or Cartesian Join or Cross Join ) occurs when a table is not related to another table in the same query by any join conditions. There is no Cartesian join in the code you posted. There are only 2 tables in the main query, and they are related by this join condition:
where t1.sub_item_cd = t2.sub_item_cd(+) --------#4The in-line view references only 1 table; it has no join, Cartesian or otherwise.
When you don't post any sample data (CREATE TABLE and INSERT statements), then you can't expect any code that's posted in reply to be tested, so don't blame Marcus for posting a reply that doesn't do what you want.
Similar Messages
-
Error while selecting date from external table
Hello all,
I am getting the follwing error while selecting data from external table. Any idea why?
SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
2 SE_CUST_ID NUMBER(38),
3 SE_TRAN_AMT_LCY FLOAT(126),
4 SE_REVERSAL_MARKER VARCHAR2(255))
5 ORGANIZATION EXTERNAL (
6 TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY ext_tables
8 ACCESS PARAMETERS (
9 RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ','
11 MISSING FIELD VALUES ARE NULL
12 (
13 country_code CHAR(5),
14 country_name CHAR(50),
15 country_language CHAR(50)
16 )
17 )
18 LOCATION ('SE2.csv')
19 )
20 PARALLEL 5
21 REJECT LIMIT UNLIMITED;
Table created.
SQL> select * from se2_ext;
SQL> select count(*) from se2_ext;
select count(*) from se2_ext
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04043: table column not found in external source: SE_REF_NO
ORA-06512: at "SYS.ORACLE_LOADER", line 19It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
HTH -- Mark D Powell -- -
Exporting selected contacts from Outlook 2011 for Mac
I've wanted to easily export a set of selected contacts from Outlook in Microsoft Office for Mac 2011. I've been through many threads about synching to Address Book and then exporting, but I've found a host of troubles, including duplicate copies of contacts being created.
So, I finally broke down and wrote an AppleScript script to export all of the currently selected contacts from Outlook to a file in either vcf (vcard) or csv (comma separated value) format. The best use of this script is to:
-- Install this as a script in Microsoft Outlook by saving the script below to Documents>Microsoft User Data>Outlook Script Menu Items
-- Change to your Contacts in Outlook. Use the Outlook search bar to find the contacts you want to export. You might search by name, category, company, or anything else that identifies the contacts you want to export. Or, you might just leave the view showing all contacts.
-- Select the contacts you want to export
-- Launch the script
The script will have you select between vcard and csv and select a destination file. This hasn't been optimized for speed, so if you're exporting 100's or 1,000's of contacts, be patient. And there isn't a progress bar at present, so you have to wait. It will display an alert when it's complete.
Sorry not to have a download location for you. You'll just have to copy the script text :-). Keep in mind there's been some but limited testing. Read the comments for details. And enjoy.
-- jsc
-- Export Outlook Contacts
-- (c) 2012 J. Scott Carr. The script is made available for free use, with no
-- warranty, under the Creative Commons license agreement.
-- This script has only been tested on Mac OS X 10.6.8 with Micrsoft Outlook for
-- Mac 2011 version 14.1.4.
property byCategory : "By category"
property byPattern : "Names matching pattern"
property vcardFormat : "VCard"
property csvFormat : "CSV"
-- main
set contactsToExport to {}
-- Get the contact selection
set contactsToExport to get_contacts_to_export()
if (count of contactsToExport) is 0 then
display alert "Please select contacts to export and rerun script" as warning
return
end if
-- Shall we export to vcard or CSV?
set theFormat to vcard_or_csv()
if theFormat is "" then
display alert "Error: Must select VCard or CSV format" as warning
return
end if
-- Get and open the output file
set oFile to open_output_file(theFormat)
if (oFile is equal to -128) then
display alert "Canceled"
return
else if (oFile < 0) then
display alert "File open failed (" & oFile & ")" as warning
return
end if
-- Export the contacts
display dialog "About to export " & (count of contactsToExport) & " contacts in " & theFormat & " format. Proceed?"
if button returned of result is not "OK" then
try
close access oFile
end try
return
end if
if theFormat is vcardFormat then
export_to_vcard(contactsToExport, oFile)
else if theFormat is csvFormat then
export_to_csv(contactsToExport, oFile)
else
display alert "Invalid format" as warning
end if
close access oFile
display alert "Complete"
return
-- get_contacts_to_export()
-- We're going to export the Contacts currently selected in Outlook.
-- Check that the current selection is Contacts and not some other Outlook
-- object. Snag the selected Contacts and return them as a list.
-- A side note. When I started this, I built options to enter a matching
-- name string or select a category. And then it hit me that those features
-- are much more robust in Outlook, and it would be easy to just use the
-- current selection.
-- There is some strange behavior that Outlook needs to have recently been
-- the front, active window.
on get_contacts_to_export()
set selectedContacts to {}
tell application "Microsoft Outlook"
set theSelection to selection
if class of theSelection is list then
if class of the first item of theSelection is contact then
copy theSelection to selectedContacts
end if
else
if class of theSelection is contact then
copy theSelection to selectedContacts
end if
end if
return selectedContacts
end tell
end get_contacts_to_export
-- vcard_or_csv()
-- Get the format to use when exporting contacts
on vcard_or_csv()
choose from list {vcardFormat, csvFormat} with prompt "Select export file format:"
if result is false then
return ""
else
return first item of result
end if
end vcard_or_csv
-- open_output_file()
-- Open the destination file for the export, returning the file descriptor or the error number
-- if the operation fails
on open_output_file(exportType)
-- Get the filename, letting "choose file name" deal with existing files.
set theDate to current date
set theTime to time of theDate
if exportType is csvFormat then
set fileName to "contacts.csv"
else
set fileName to "contacts.vcf"
end if
try
set outputFile to choose file name with prompt "Select export destination file" default name fileName
on error errText number errNum
return errNum
end try
-- Open the file
try
-- Open the file as writable and overwrite contents
set oFile to open for access outputFile with write permission
set eof oFile to 0
on error errText number errNum
display alert "Error opening file: " & errNum & return & errText as warning
try
close access oFile
end try
return errNum
end try
return oFile
end open_output_file
-- export_to_vcard()
-- Export each of theContacts to the open file outFile as a set of vcards. Note that the
-- vcard data is from the "vcard data" property of the theContacts. This routine
-- doesn't attempt to reformat an Outlook vcard, nor limit the fields included
-- in the vcard.
on export_to_vcard(theContacts, outFile)
set vcards to {}
tell application "Microsoft Outlook"
repeat with aContact in theContacts
copy vcard data of aContact to the end of vcards
end repeat
end tell
repeat with aCard in vcards
write (aCard & linefeed) to outFile
end repeat
end export_to_vcard
-- export_to_csv()
-- Export each of theContacts to the open file outFile in csv format
on export_to_csv(theContacts, outFile)
set csvFields to {}
-- Get the fields of the contact to export
set csvFields to init_csv()
-- Write the header row
set nFields to count csvFields
write first item of csvFields to outFile
repeat with i from 2 to nFields
write "," & item i of csvFields to outFile
end repeat
write linefeed to outFile
-- Export the fields of the contacts in CSV format, one per line
repeat with aContact in theContacts
write build_csv_line(csvFields, aContact) & linefeed to outFile
end repeat
end export_to_csv
-- init_csv(): defines the fields to export when csv format is selected
-- Each of the fields in the list must match a name used in the routine build_csv_line().
-- The idea is to later create a a pick list so the user can select which contact properties
-- to export.
on init_csv()
set csvFields to {"first name", "last name", "middle name", "title", "nickname", "suffix", "phone", "home phone number", "other home phone number", "home fax number", "business phone number", "other business phone number", "busines fax number", "pager number", "mobile number", "home email", "work email", "other email", "company", "job title", "department", "assistant phone number", "home street address", "home city", "home state", "home country", "home zip", "business street address", "business city", "business state", "business country", "business zip", "home web page", "business web page", "note"}
end init_csv
-- build_csv_line(): format one line for the csv file
-- Parameter csvFields determins which fields to include in the export.
-- Unfortunately I've not figured out how to use perl-style generation of
-- indirect references. If I could, this would have been much more elegant
-- by simply using the field name to refer to a Contact properly.
-- Note that email address are a special case as they're a list of objects in
-- Outlook. So these are handled specially in the export function and can only
-- be selected by the column names "home email", "work email", and "other email".
-- Outlook allows a contact to have more than one of each type of email address
-- but not all contact managers are the same. This script takes the first of
-- each type. So if a contact has more than one "home" email address, you will
-- only be able to export the first to a csv file. Suggest you clean up your
-- addresses in Outlook to adapt. The alternative is to support multiple
-- columns in the csv like "other email 1" and "other email 2", but that's not
-- supported in this version.
-- Another note. In this version, any embedded "return" or "linefeed" characters
-- found in a property of a contact are converted to a space. That means that
-- notes, in particular, will be reformated. That said, this gets arond a problem
-- with embedded carriage returns in address fields that throw off importing
-- the csv file.
-- Also note that at this time IM addresses aren't supported, but it's an easy add
-- following the same logic as email addresses.
on build_csv_line(csvFields, theContact)
set aField to ""
set csvLine to ""
set homeEmail to ""
set workEmail to ""
set otherEmail to ""
tell application "Microsoft Outlook"
set props to get properties of theContact
-- Extract email addresses from address list of contact
set emailAddresses to email addresses of props
repeat with anAddress in emailAddresses
if type of anAddress is home then
set homeEmail to address of anAddress
else if type of anAddress is work then
set workEmail to address of anAddress
else if type of anAddress is other then
set otherEmail to address of anAddress
end if
end repeat
-- Export each desired fields of the contact
repeat with aFieldItem in csvFields
set aField to aFieldItem as text
set aValue to ""
if aField is "first name" then
set aValue to get first name of props
else if aField is "last name" then
set aValue to last name of props
else if aField is "middle name" then
set aValue to middle name of props
else if aField is "display name" then
set aValue to display name of props
else if aField is "title" then
set aValue to title of props
else if aField is "nickname" then
set aValue to nickname of props
else if aField is "suffix" then
set aValue to suffix of props
else if aField is "phone" then
set aValue to phone of props
else if aField is "home phone number" then
set aValue to home phone number of props
else if aField is "other home phone number" then
set aValue to other home phone number of props
else if aField is "home fax number" then
set aValue to home fax number of props
else if aField is "business phone number" then
set aValue to business phone number of props
else if aField is "other bsiness phone number" then
set aValue to other business phone number of props
else if aField is "bsuiness fax number" then
set aValue to business fax number of props
else if aField is "pager number" then
set aValue to pager number of props
else if aField is "mobile number" then
set aValue to mobile number of props
else if aField is "home email" then
set aValue to homeEmail
else if aField is "work email" then
set aValue to workEmail
else if aField is "other email" then
set aValue to otherEmail
else if aField is "office" then
set aValue to office of props
else if aField is "company" then
set aValue to company of props
else if aField is "job title" then
set aValue to job title of props
else if aField is "department" then
set aValue to department of props
else if aField is "assistant phone number" then
set aValue to assistant phone number of props
else if aField is "age" then
set aValue to age of props
else if aField is "anniversary" then
set aValue to anniversary of props
else if aField is "astrololgy sign" then
set aValue to astrology sign of props
else if aField is "birthday" then
set aValue to birthday of props
else if aField is "blood type" then
set aValue to blood type of props
else if aField is "desription" then
set aValue to description of props
else if aField is "home street address" then
set aValue to home street address of props
else if aField is "home city" then
set aValue to home city of props
else if aField is "home state" then
set aValue to home state of props
else if aField is "home country" then
set aValue to home country of props
else if aField is "home zip" then
set aValue to home zip of props
else if aField is "home web page" then
set aValue to home web page of props
else if aField is "business web page" then
set aValue to business web page of props
else if aField is "spouse" then
set aValue to spouse of props
else if aField is "interests" then
set aValue to interests of props
else if aField is "custom field one" then
set aValue to custom field one of props
else if aField is "custom field two" then
set aValue to custom field two of props
else if aField is "custom field three" then
set aValue to custom field three of props
else if aField is "custom field four" then
set aValue to custom field four of props
else if aField is "custom field five" then
set aValue to custom field five of props
else if aField is "custom field six" then
set aValue to custom field six of props
else if aField is "custom field seven" then
set aValue to custom field seven of props
else if aField is "custom field eight" then
set aValue to custom field eight of props
else if aField is "custom phone 1" then
set aValue to custom phone 1 of props
else if aField is "custom phone 2" then
set aValue to custom phone 2 of props
else if aField is "custom phone 3" then
set aValue to custom phone 3 of props
else if aField is "custom phone 4" then
set aValue to custom phone 4 of props
else if aField is "custom date field one" then
set aValue to custom date field one of props
else if aField is "custom date field two" then
set aValue to custom date field two of props
else if aField is "note" then
set aValue to plain text note of props
end if
if aValue is not false then
if length of csvLine > 0 then
set csvLine to csvLine & ","
end if
if (aValue as text) is not "missing value" then
set csvLine to csvLine & "\"" & aValue & "\""
end if
end if
end repeat
end tell
-- Change all embeded "new lines" to spaces. Does mess with the formatting
-- of notes on contacts, but it makes it cleans the file for more reliable
-- importing. This could be changed to an option later.
set csvLine to replace_text(csvLine, return, " ")
set csvLine to replace_text(csvLine, linefeed, " ")
return csvLine
end build_csv_line
-- replace_text()
-- Replace all occurances of searchString with replaceString in sourceStr
on replace_text(sourceStr, searchString, replaceString)
set searchStr to (searchString as text)
set replaceStr to (replaceString as text)
set sourceStr to (sourceStr as text)
set saveDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to (searchString)
set theList to (every text item of sourceStr)
set AppleScript's text item delimiters to (replaceString)
set theString to theList as string
set AppleScript's text item delimiters to saveDelims
return theString
end replace_textThank You, but this is a gong show. Why is something that is so important to us all so very, very difficult to do?
-
Select rows from the table which don't exist in another table
Hi, in this relatively simple task I have some problem. I need to get the records from the T1 which don't exist in T2, based on some criteria.
here is my query:
select a.ordernum, sum(totchg), b.tracknum, rownum from T1 a, T2 b where 1=1 and a.ordernum not in( select ordernum from T2 ) and entrydate between to_date('06/23/2007','MM/dd/yyyy') and to_date('06/30/2007','MM/dd/yyyy') group by a.ordernum, b.tracknum, rownum
it suppose to return me "TRACKNUM" empty, however it's being returned populated.
I also tried :
select a.ordernum, sum(totchg),b.tracknum, rownum from T1 a,
T2 b where[b] not exists( select '1' from T2 where a.ordernum = b.ordernum )
and entrydate between to_date('06/23/2007','MM/dd/yyyy') and to_date('06/30/2007','MM/dd/yyyy') group by a.ordernum, b.tracknum, rownum
the results are the same.
please advise.You are trying to get a returned value field from T2 when you just said that the
records returned from Only T1 are not found in T2, therefore no T2 record to return.
You only get T1 records where the Ordernum key is not found in T2.
select ordernum, tracknum, rownum, sum(totchg)
from T1
where ordernum not in( select ordernum from T2 )
and (entrydate between to_date('06/23/2007','MM/dd/yyyy') and
to_date('06/30/2007','MM/dd/yyyy') )
group by ordernum, tracknum, rownum -
Select text from all_views returns an empty string
My application allows the user to select between the Data Provider for ODBC and the Data Provider for Oracle. (ODP)
When using the ODBC provider the statement:
Select text from all_views where view_name='MYVIEW'
returns the expected string.
If I connect via ODP however it returns an empty string.
(If I use 'Select *' it tells me the text_length is 154 in this specific case - so there is definately text available.)
I'm thinking it has something to do with the fact that the data type is LONG.
In both cases I retreive the data using rdr.GetChars(), which should work.
If I use the dbms_metadata.get_ddl function instead, it does return the string (Probably because the return type is not LONG)
Unfortunately that function only works for Views in the current schema, while the original Select works for any view.
(And I dont know what version of Oracle this function was added in - I have to support older versions too.)
Similarly, if I use one of the XML functions to retreive the text as XML it works fine.
(Again it is probably returned as a VARCHAR2 instead of a LONG.)
The strange thing is that when I created my own table containing a LONG column I was able to load and retreive data without any problems.
The problem appears to be specific to this column in all_views.
Anyone know a solution to this?
Thanks
MikeThanks that was it.
I had not seen those properties since I am working with the 'generic' objects (DbCommand rather than OracleCommand, etc.)
What is strange is that I was able to retreive data from my own LONG column WITHOUT setting this value to -1.
(It defaulted to 0 in both cases.)
The only difference was that when I retreived data from my own column I specified CommandBehaviour.SequentialAccess.
When I retreived the all_views.text column I did not specify a behaviour at all.
However the Oracle docs said that SequentialAccess is not supported ... so I guess that is not correct.
(Maybe it doesn't 'work', but it certainly seems to cause things to work differently)
Thanks
Mike -
Selecting data from Multiple Partitions in a single select stmt.
Hi all,
My Database is very large & my tables are partitioned.
My question is:
1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
(Note:I dont want to make use of Union concept, i want to do it in a single select statement)
For ex:
qry1.sql:
select empno from emp_trans partition (P012000)
This above query(qry1.sql) will work fine.
qry2.sql:
select empno from emp_trans partition (P012000,P022000)
The above query(qry2.sql) will return will return the following error:
ORA-00933: SQL command not properly ended
If anybody has any solution for this, pls mail me immediately.
Thanks in advance
bye
nullAll my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
Thaks for ur reply
Bye
null -
First, how do I create my own favorite theme template for DVD slideshows? I used to be able to select this from pulldown menu, but cannot now do so. I am directed straight to already existing themes, which take more memory. I have a large slideshow, and need all the space I can get. I just want to use a picture as my DVD cover, and then insert a slideshow. Also, when I try to burn my 8.5gb double sided slideshow, all that burns is the music. It is a large slideshow, a memorial on the life of my now deceased brother. This means a lot to me and to my family, and I am having so much trouble trying to burn it. I have gone into Project View and selected appropriately. The bar shows I have room to burn this DVD, but it does not burn. I have burned so many DVDs in the past, but this one just will not burn. I am so confused at this point. I will say this is the first 8.5gb I have attempted to create and burn. My specs list a 7.7gb or 4.7gb as operable....but there are no 7.7gb dvds. I had to purchase 8.5gb. Help? What am I doing wrong? I have spent so much time on this, and just cannot figure it out.
Final Cut is a separate, higher end video editor. The pro version of iMovie.
Give iPhoto a look at for creating the slideshow. It's easy to assemble the photos in an album in iPhoto, put them in the order you want and then make a slideshow of them. You can select from various themes and transitions between slides and add music from your iTunes library.
When you have the slidshow as you want use the Export button at the bottom of the iPhoto window and export with Size = Medium or Large.
Save the resulting Quicktime movie file in your Movies folder.
Next, open iDVD, choose your theme and drag the QT movie file into the menu window being careful to avoid any drop zones.
Then follow this workflow to help assure the best qualty video DVD:
Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image menu option. This will separate the encoding process from the burn process.
To check the encoding mount the disk image, launch DVD Player and play it. If it plays OK with DVD Player the encoding is good.
Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality. Always use top quality media: Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
The reason I suggest iPhoto is that I find it much easier to use than iMovie (except for the older iMovie 6 HD version). Personal preferences showing here. -
When is select Bookmarks from the Menu Bar, at the very bottom are a bunch of bookmarks. How can I move these in groups to a folder or folders?
The easiest way to move bookmarks around is in the Bookmarks Organizer, which at some point was renamed the Library. To open it, you can choose Bookmarks > Show All Bookmarks or press Ctrl+Shift+b.
(Please note that the sort order of the Library dialog doesn't actually carry over to the menu. To sort the menu alphabetically, it's easiest to open the Bookmarks Sidebar, right-click the words Bookmarks Menu and choose Sort by Name.) -
Hi,
we are running a query with a big dunamic select statement from VB code using ADO command object. When Execute method is called system hangs and control won't return back to the application. it seems to be that there is some type limitation on Query string length. Please tell us if there is any?
we are running Oracle 8.1.7 Server on Windows 200 Server and connecting from a W2K professional, ADO 2.6 and Oracle OLEDB 8.1.7.1 OLEDB Driver.
Sample code:
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Set cmd = New Command
With cmd
.CommandText = ' some text with more than 2500 characters
.CommandType = adCmdText
Set rs = .Execute
End With
when i debug using VB6 and when .Execute line is called system hangs or return a message method <<somemethod> of <<some class name>> failed error.
Any help is appreciated.
Thanks,
AnilA stored procedure would only slow you down here if it was poorly written. I suspect you want to use the translate function. I'm cutting & pasting examples from the documentation-- a search at tahiti.oracle.com will give you all the info you'll need.
Examples
The following statement translates a license number. All letters 'ABC...Z' are translated to 'X' and all digits '012 . . . 9' are translated to '9':
SELECT TRANSLATE('2KRW229',
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'9999999999XXXXXXXXXXXXXXXXXXXXXXXXXX') "License"
FROM DUAL;
License
9XXX999
The following statement returns a license number with the characters removed and the digits remaining:
SELECT TRANSLATE('2KRW229',
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', '0123456789')
"Translate example"
FROM DUAL;
Translate example
2229
Also, LIKE '%<string>%' is going to be rather expensive simply because it has to compare the entire string and because it forces full table scans, rather than using indexes. You could speed this sort of query up by using interMedia Text (Oracle Text now in 9i). If you can eliminate one of the '%' options, you could also improve things.
My guess is that your stored procedure is inefficient and that's causing the problem-- 5k rows per table should be pretty trivial.
If you post your query over on the PL/SQL forum, there are better performance tuners than I that might have more hints for you. To get really good advice, though, you'lllikely have to get at least the execution plan for this statement and may need to do some profiling to identify the problem areas.
Justin -
Getting selected item from combobox itemrenderer and storing in object
Hi Guys,
Can anyone help me in this regard. Its very urgent.
I have a combo box itemrenderer in datagrid column. I want to get the user selected item from the dropdown of the row(s) (User may select values from combo box from multiple rows of datagrid) and corressponding values of all other columns of the rows and store it in an object . Then pass this object to database to update only those rows that user has changed.
I am able to get the selected item from combo box using "event.currentTarget.selectedItem" and corressponding values of all other columns of the rows using "valueSelect.ID", etc where valueSelect is object which contains data for datagrid. But am stuck up with, how to store the selected item value of the combobox and corressponding values of all other columns of the rows into an Object ?.
Can anybody help me with sample to store selected item from combobox and its corressponding values of all other columns into an object which i can send to db...?
Kindly help me in this regard.
Thanks,
Anand.Hi!
Are you using a collection of VO or DTO as the dataprovider of the combobox component?
If so, have you created some attribute there to control the user's selection in the combobox?
For instance:
private var selected:Boolean = false;
If your solution fits this approach, you may create a new collection that contains just the objects that were selected by the user, it means you can loop through the datagrid's dataprovider and only insert in this new collection those objects that have the attribute "selected" set to true.
For instance:
private function getSelectedRecords(datagridDataProvider:ArrayCollection):ArrayCollection
var newCollection:ArrayCollection = new ArrayCollection();
for each (var item:Object in datagridDataProvider)
if (item.selected)
newCollection.addItem(item)
return newCollection;
Afterwards, you may serialize this new collection with your back-end.
Hope it helps you!
Cheers,
@Pablo_Souza -
How to get selected value from selectOneRadio ???
Hi...i want to how to get selected value from selectOneRadio and use it in another page and in backing bean.
Note i have about 10 selectOneRadio group in one page i want to know value of each one of them.
Plzzzzzzzz i need helpYou have a datatable in which each row is a question, correct?
Also in each row you have 5 possible answers that are in a radio, correct?
So,
You need to put in your datatable model, a question, and a list of answers (5 in yor case) and the selected one.
So you will have a get to the question, an SelectItem[] list to populate the radios and another get/set to the selected question.
ex:
<h:selectOneRadio value="#{notas.selectedString}" id="rb">
<f:selectItem itemValue="#{notas.valuesList}"/>
</h:selectOneRadio>
Search the web for examples like yours. -
How to get selected value from OADefaultListBean.
Hi All,
How to get selected value from OADefaultListBean ?
Thanks,Hi,
To identify the user's selection(s) when the page is submitted, you would add the following logic to your processFormRequest() method:
OADefaultListBean list =
(OADefaultListBean)webBean.findChildRecursive("positionsList");
String name = list.getName();
String[] selectedValues = pageContext.getParameterValues(name);
To retrieve all the values in the list box, call list.getOptionsData().
--Prasanna -
How to get selected values from selectManyCheckbox ?
Hi,
I am a SOA developer and using 'Auto generated adf form' of Human Task. I did some customization in the form. I need to show one dynamic list (contains multiple string values) on a form, from which user will select desired values. For this I have used <af:selectManyCheckbox> adf component.
It has generated code as follows...
<af:selectManyCheckbox value="#{bindings.Response.inputValue}"
label="#{bindings.Response.label}"
id="smc1">
<f:selectItems value="#{bindings.Response.items}" id="si9"/>
</af:selectManyCheckbox>
I am able to show list on a form and can select multiple values also.
Now, I want the multiple selected values back in my BPEL process. I need only those values which are selected by user.
Currently I am getting complete list as it is back in BPEL process.
Please help me out..!
Thanks..
SurajUnwinding ADF: How to retrieve Selected Items from selectManyCheckbox using ValueChnageListener
-
How to get selected values from tableSelectMany
Hi all,
I have a view object which displays all column names of a table. I created a tableselectmany table with the view object.
the user has to select some rows (for mining function).
how to get the selected rows from tableselectmany table?
what should be in 'action' and 'actionlistener' ?
thanks in advance.test(Set<Key> empKeys){
System.out.println("Inside function");
for(Key keys:empKeys){
Row[] row = getCollectionsView1().findByKey(keys,1);
EewCollectionsViewRowImpl vo = (CollectionsViewRowImpl)row[0];
In the action just call this method(test)
and pass the argument as #{applicationScope.managedBean.firstProperty.selectionState.keySet}
I hope this works for you. -
How to get selected value from SelectOneChoice
Hi,
I'm facing a problem to get selected value from SelectOneChoice. I have valueChangeListener event on a (SelectOneChoice)item. After user makes a choice I want to store selected value in a bean property to pass it to a method.
For example List item shows dname from dept table after user makes a choice I want to get deptno and populate into bean which I use to pass into my method.
If I use valueChangeEvent.getNewValue() I always get negative value instead I want deptno selected. Sample code pasted below.
public void setDeptno(ValueChangeEvent valueChangeEvent) {
BindingContainer b = getBindings();
OperationBinding oB = b.getOperationBinding("setDeptno");
//Checking instance of because same method is called from another text inputText item.
if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
if (columnName.getId().toString().equals("deptDname")){
JSFUtils.setManagedBeanValue("dept.deptDeptno",valueChangeEvent.getNewValue());
}if your selectOneChoice has value equal to #{bindings.deptno} bound to the iterator Dept1Iterator,
then the backing code will look more like
public void setDeptno(ValueChangeEvent valueChangeEvent) {
BindingContainer b = getBindings();
OperationBinding oB = b.getOperationBinding("setDeptno");
//Checking instance of because same method is called from another text inputText item.
if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
if (columnName.getId().toString().equals("deptDname")){
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
ValueBinding bind = app.createValueBinding("#{bindings.Dept1Iterator.currentRow}");
Row row = (Row)bind.getValue(ctx);
JSFUtils.setManagedBeanValue("dept.deptDeptno", row.getAttribute("deptno"));
} I haven't tested it, so it could perfectly not work at all -
Dvt:pivotFilterBar - how to get selected values from filter
Hi all,
I have a question: how to programmatically get selected values from pivot table's filter bar?
I have tried to use
pivotTable.getDataModel().getDataAccess().getValueQDR(startRow, startCol, DataAccess.QDR_WITH_PAGE);but for page edge dimensions it returns BAD DATA, it seems that it returns some cached values.
Environment: JDev 11.1.1.3.0 without any patches.
thanks,
MiroslawHi,
You can retrieve the selected value in the PivotFilterBar through the model of PivotFilterBar, instead of dataaccess:
// get the model from the pivot filter bar instance
QueryDescriptior queryDescriptor = (QueryDescriptor)pivotFilterBar.getValue();
// retrieve a list of criterion, each one is used to populate each lov within the pivot filter bar
ConjunctionCriterion conjunctionCriterion = queryDescriptor.getConjunctionCriterion();
List<Criterion> criterionList = conjunctionCriterion.getCriterionList();
for (int i=0; i<_criterionList.size(); i++) {
AttributeCriterion criterion = (AttributeCriterion)criterionList.get(i);
// _selected is the currently selected value
Object selected = criterion.getValues().get(0);
System.out.println(_selected);
Hope that helps,
Chadwick
Maybe you are looking for
-
Lack of Real Customer Care by BT.
I get my new you view box from BT on 16th December, 2013 and by 21st December it is not working and the best BT can do is send an engineer out on the 27th December obviously after the key Christmas viewing period. I talked through the issue with BT t
-
I am trying to sync a few photos from Aperture to my iPhone. However, only 2,800 of the 85,000 photos are available in iTunes during the sync set-up. Any suggestions to make iTunes see all of my photos in Aperture?
-
HTML 5 PivotViewer with SharePoint 2013
Hey Experts, I am in a situation to integrate HTML 5 PivotViewer control with SharePoint 2013 site collection. Can anyone please guide me, how can I integrate? Thanks in advance for your upcoming wonderful help. Sekar - Our life is short, so help
-
Scenario: I am trying to send a mail to the "Sales Person" when new lead is created. Here "Sales Person" and "Owner" are different. The worlflow I have written with Trigger Event "*When new record Saved*" and Worlflow Rule condition is [<LeadOwner>]
-
TS1967 my itunes shortcut stopped working
the itune shortcut stopped working, so i deleted it bec. that was the only option. i resintalled the latest itunes & still- can't figure this out. went into music folder, itunes is in there, but not a new player icon. i can't figure out how to launch