Please Suggest, How to make this view efficient ?

Hi there,
Could you please suggest me,how to make the following VIEW (QUERY) efficient regarding performance point of view.
CREATE OR REPLACE VIEW XXX_TRX_TO_NUM_V
(ROW_NUM, ORIG_TRX_NUM, TRX_NUMBER, TRX_DATE, PURCHASE_ORDER,INTERFACE_HEADER_ATTRIBUTE6, INTERFACE_HEADER_ATTRIBUTE1, INTERFACE_HEADER_ATTRIBUTE5, BILL_TO_CONTACT_ID, REMIT_TO_ADDRESS_ID, BILL_TO_CUSTOMER_ID, BILL_TO_SITE_USE_ID, ORG_ID)
AS
Select rownum row_num,trx_number orig_trx_num,to_number(a.trx_number) trx_number,a.trx_date,a.purchase_order,a.interface_header_attribute1
,a.interface_header_attribute6,a.interface_header_attribute5,a.bill_to_contact_id
,a.remit_to_address_id,a.bill_to_customer_id,a.bill_to_site_use_id,a.org_id
from ra_customer_trx_all a
where a.trx_number is not null
and a.trx_number not in
(select trx_number
from
(select rownum,/*+ ALL_ROWS ,16 */ r.trx_number,ltrim(rtrim(translate(/*+ ALL_ROWS ,16 */ r.TRX_number,'0123456789',' '), ' ' ), ' ' ) tx
from ra_customer_trx_all r)
where tx is not null)
order by trx_number
Thanks in Advance !
Shahzad

I think you have the hints in the wrong place - as far as I was aware, the hint had to come straight after the SELECT/UPDATE/INSERT/DELETE key word - but I could be wrong as I've never really tried it elsewhere. Also, unless the optimiser mode for your database is set to FIRST_ROWS or RULE (god help you!:), ALL_ROWS is the default behaviour.
Basically what you are trying to say is bring me back all ra_customer_trx_all rows that have purely numeric trx_numbers right?
Why, if you need to be able to represent trx_number as a number, do you have non-numeric data in there???? That's a bit dodgy isn't it?
Anyway, what about:
CREATE TABLE dt_test_num (id varchar2(10))
insert
into
     dt_test_num
select
     chr(47 + rownum)
from
     all_tables
where
     rownum <= 20
select
     to_number(id),
     id
from
     dt_test_num
where
     translate(id,'0123456789',' ') IS NULL
update
     dt_test_num
set
     id=id||chr(67-rownum)
select
FROM
     dt_test_num
select
     to_number(id),
     id
from
     dt_test_num
where
     translate(id,'0123456789',' ') IS NULL
/Also, you are selecting rownum and aliasing it. Why? rownum will be assigned before the sort.
HTH
David
Message was edited by:
david_tyler
Hello
Slight correction to the where clause. Art first I thought you didn't need the trim on there, but that was just down to the number sequence in translate...
SQL> select nvl(translate('1A','1234567890',''),'NULL') from dual
  2  /
NVL(
NULL
SQL> select nvl(translate('1A','1234567890',' '),'NULL') from dual
  2  /
NV
A
SQL> select nvl(translate('1','1234567890',' '),'NULL') from dual
  2  /
N
SQL> select nvl(translate('2','1234567890',' '),'NULL') from dual
  2  /
NVL(
NULL
SQL> select nvl(translate('2','0123456789',' '),'NULL') from dual
  2  /
NVL(
NULL
SQL> select nvl(translate('1','0123456789',' '),'NULL') from dual
  2  /
NVL(
NULL
SQL> select nvl(translate('0','0123456789',' '),'NULL') from dual
  2  /
N
SQL> select nvl(TRIM(translate('0','0123456789',' ')),'NULL') from dual
  2  /
NVL(
NULL
SQL> select nvl(TRIM(translate('1','0123456789',' ')),'NULL') from dual
  2  /
NVL(
NULLTranslate still confuses me :-(

Similar Messages

  • TS2634 I bought a composite AV cable with 30 pin connector at a proper apple store for my ipad 2 which no longer works now i have updated to ios7 - please advise how to make this work ?

    I bought a composite AV cable with 30 pin connector at a proper apple store for my ipad 2 which no longer works now i have updated to ios7 - please advise how to make this work ?

    I have the same problem.
    Two similar discussions:
    https://discussions.apple.com/message/23081658#23081658
    https://discussions.apple.com/message/23281391#23281391
    I have not yet seen any official response to the question: "Is the Apple AV Composite cable fully supported with 30pin connector devices upgraded with iOS7 - specifically ? - eg. iPad 2, iPhone 4, iPhone 4s"
    If it is not currently supported is that then due to a bug / oversight and in that case is it something that will be fixed in the near future?
    Please let us know what feedback you got from asking Apple support.

  • Hello, iam using the latest version of firefox, whenever i login into my yahoo mail account i get a stop script error, the details of the error script is mentioned below , please suggest how to stop this : STOP ERROR

    Hello, iam using the latest version of firefox, whenever i login into my yahoo mail account i get a stop script error, the details of the error script is mentioned below , please suggest how to stop this
    the website is www.mail.yahoo.com. i was getting the same STOP script error every now and then in firefox 6 as well

    I have had a similar problem with my system. I just recently (within a week of this post) built a brand new desktop. I installed Windows 7 64-bit Home and had a clean install, no problems. Using IE downloaded an anti-virus program, and then, because it was the latest version, downloaded and installed Firefox 4.0. As I began to search the internet for other programs to install after about maybe 10-15 minutes my computer crashes. Blank screen (yet monitor was still receiving a signal from computer) and completely frozen (couldn't even change the caps and num lock on keyboard). I thought I perhaps forgot to reboot after an update so I did a manual reboot and it started up fine.
    When ever I got on the internet (still using firefox) it would crash after anywhere between 5-15 minutes. Since I've had good experience with FF in the past I thought it must be either the drivers or a hardware problem. So in-between crashes I updated all the drivers. Still had the same problem. Took the computer to a friend who knows more about computers than I do, made sure all the drivers were updated, same problem. We thought that it might be a hardware problem (bad video card, chipset, overheating issues, etc.), but after my friend played around with my computer for a day he found that when he didn't start FF at all it worked fine, even after watching a movie, or going through a playlist on Youtube.
    At the time of this posting I'm going to try to uninstall FF 4.0 and download and install FF 3.6.16 which is currently on my laptop and works like a dream. Hopefully that will do the trick, because I love using FF and would hate to have to switch to another browser. Hopefully Mozilla will work out the kinks with FF 4 so I can continue to use it.
    I apologize for the lengthy post. Any feedback would be appreciated, but is not necessary. I will try and post back after I try FF 3.16.6.

  • How to make this program efficient?

    Hola Amigos, I'm trying to explore all the possibilities about comparing two arrays. I know the following code is O(n^2) is it possible to make it O(n) without recursion or is recursion the only way. I ask this because we are being taught recursion and I don't quite understand it. I don't see the relation from recursion taught in Discrete Math with the one taught in programming, Thanks.....
    public class twoArrays
         public static int max = -1;
         public static int findMax(int oneArray [], int twoArray [])
              for (int i = 0 ; i < oneArray.length ; i ++)
                   for ( int j = 0; j < twoArray.length ; j++)
                        max = Math.max(max,Math.max(oneArray,twoArray[j]));     
              return max;
         public static void main (String [] args)
              int[] a = {1,5,8,30,80,99,140,160,170,180,190,200};
              int[] b = {2,4,7,45,60,85,98,150,155,175,195,205};
              findMax(a,b);
              System.out.println("The highest value is: " + max);
    Ah, one more thing the word "static" how can I call a method from a non-static context. Very confussing for me, thanks again.

    To call a non-static method you can use an instance of the class.
    Example:
    public class twoArrays {
    public static int max = -1;
    public int findMax(int oneArray [], int twoArray []){//non-static
         for (int i = 0 ; i < oneArray.length ; i ++){
         for ( int j = 0; j < twoArray.length ; j++)                    max = Math.max(max,Math.max(oneArray,twoArray[j]));          }
         return max;
    public static void main (String [] args)     {          
    int[] a = {1,5,8,30,80,99,140,160,170,180,190,200};
    int[] b = {2,4,7,45,60,85,98,150,155,175,195,205};
    ( new twoArrays() ).findMax(a,b);/*through an anonymous instance of the class, you can call findMax method */
    System.out.println("The highest value is: " + max);          
    Hope it will help you.
    p.d.: max is initialized -1 cause then into findmax, you asure that max will never again has value -1 (the two arrays contains numbers > -1 )so max at least will be higher than -1.
    Sorry for my english.
    Saludos

  • I have brought an Apple iphone 4 from Apple store Arndale house for use any network, but this phone is locked with vodafone. Please suggest, how to unlock this phone to use all other network in other country?

    Dear Team,
    i had brought a APPLE IPHONE4 from APPLE STORE, MANCHESTER ARNDALE. new cannon street mall.
    when i was visiting for purchasing this device the sales team told me that the phone is unlocked and can use all around the world with any other network when i'm trying to use it other network it showed that NO SERVICE(at network issue) and then i made a call 2 apple customer support so the executive told me that this device has been locked with VODAFONE UK network. this was the FAKE commitment of sales team also its a CHEATING i must say that.
    i'm very much disapointed and dissatiesfied with the APPLE STORE sales team...
    kindely look toward and give me solution.
    thanks,
    regard,
    Nishant Kumar

    I had read that thanks but many happy owners of locked iPhones
    claim to have bought from an Apple store they do not actually mean
    Apple Retail
    Arndale Centre is one of the largest Malls in Europe and every vendor of iPhones is there
    Apple retail in UK ONLY sell unlocked iPhones unless you opt for a contract at a reduced price
    not something you can do accidently as in sim free in US
    But thanks for you guidance

  • The GPU acceleration feature in LR 6 states that it has been disabled due to error; yet it is working in PS 6.  Any suggestions how to make this work in LR 6?

    Video card is up to date and meets the requirements for LR 6. 

    Video card is up to date and meets the requirements for LR 6. 

  • How to make this query efficient

    create table temp)au_sa_poi_geocoding2 as select idx, address_form, suburb_form
    from temp_au_Sa_poi_geocoding a where idx not in (select idx from gc1_Sa_sub where status='m' ) and exists (select null from sh_poi_small cites c
    where upper (trim(a.suburb_form))=c.city)
    one table contain round 74214 records while the other has less than that.
    the tables were not indexed, i created index using the following commands.
    create index sa_idx on temp_au_sa_poi_geocoding(idx)
    create index sa1_idx on gc1_sa_sub(idx)
    anyhelp would be appreciated.
    thanks

    create index sa0_idx on temp_au_Sa_poi_geocoding(upper(trim(suburb_form)));
    create index sa1_idx on gc1_sa_sub(status,idx); -- instead of only (idx)
    create index sh_idx on sh_poi_small (city);
    then try as follows
    create table temp_au_sa_poi_geocoding2 as select idx,
    address_form, suburb_form
    from temp_au_Sa_poi_geocoding a where idx not in
    (select /*+ index gc1 */ idx from gc1_Sa_sub gc1 where status='m' ) and
    exists (select /*+ index_join c a */ null from sh_poi_small cites c
    where upper (trim(a.suburb_form))=c.city)
    however effects of indexes will vary by cardinality.

  • How do make this query ?

    CREATE TABLE CLIENT (
         CLIENTID NUMBER PRIMARY KEY,
         NAME VARCHAR2(40)
    CREATE TABLE SALESMAN (
         SALESMANID NUMBER PRIMARY KEY,
         NAME VARCHAR2(40),
         ALL_CLIENTS NUMBER -- ACCESS ALL CLIENTS IF VALUE IS 1
    CREATE TABLE CLIENTSALESMAN (
         SALESMANID NUMBER,
         CLIENTID NUMBER
    INSERT INTO CLIENT VALUES(1,'Bob');
    INSERT INTO CLIENT VALUES(2,'Jhon');
    INSERT INTO CLIENT VALUES(3,'Robert');
    INSERT INTO CLIENT VALUES(4,'Clarck');
    INSERT INTO SALESMAN VALUES (1,'Christina',0);
    INSERT INTO SALESMAN VALUES (2,'Doug',1); -- access all clients
    INSERT INTO CLIENTSALESMAN VALUES (1,1);
    INSERT INTO CLIENTSALESMAN VALUES (1,2);
    How do you return all the clients of a salesman ? same that SALESMAN.ALL = 1 OR SALESMAN.ALL = 0.
    the salesman.all is 1 then he access all clients no need insert in CLIENTSALESMAN. If SALESMAN.ALL = 0 he
    access clientsalesman.
    Does somebody some suggestion how i make this ?
    thanks !

      1  select *
      2  from (select a.name SALESMAN, b.name CLIENT
      3  from   salesman a, client b, clientsalesman
      4  where  a.SALESMANID = c.SALESMANID
      5  and    b.CLIENTID = c.CLIENTID
      6  union
      7  select a.name SALESMAN, b.name CLIENT
      8  from   salesman a, client b
      9  where   a.ALL_CLIENTS = 1)
    10* where salesman = '&1'
    SQL> /
    Enter value for 1: Christina
    old  10: where salesman = '&1'
    new  10: where salesman = 'Christina'
    Christina                                Bob
    Christina                                Jhon
    SQL> /
    Enter value for 1: Doug
    old  10: where salesman = '&1'
    new  10: where salesman = 'Doug'
    Doug                                     Bob
    Doug                                     Clarck
    Doug                                     Jhon
    Doug                                     RobertNicolas.

  • How to make this in Adobe Photoshop CS5? PLEASE Help!

    Hey guys, i reallllllllly  want to know how to make this image in adobe photoshop.... the cone around the forecast track. Can you guys please show me how to do this? Id greatly appreciate it!

    There's a lot implied here, but you're not going to get around having to do the following in general:
    Use an unmarked map as a background.
    Draw shapes on layer(s) above the background and make them partially transparent.
    Obviously the key is to draw shapes that express the "cone of uncertainty" exactly as you want it to look, and with a minimum of fuss.
    I'd suggest drawing shapes with Path tools, then filling the shapes, applying a stroke (for the edge border), and using masking to hide parts you don't want to show (or which overlap with the other parts you're drawing).
    Are you needing to do this over and over or just once?
    -Noel

  • Since i changed to Firefox 4, now I no longer can view the lower portion of my screen which reveals the LOCK security feature. Please advise how to fix this?

    Since i changed to Firefox 4, now i can no longer view the lower portion of my screen which reveals the LOCK security feature. Please advise how to fix this? if I don't hear back today, i will have to undo Firefox 4 completely

    the lock symbol has been removed in Firefox 4 and replaced with the [[Site Identity button]]
    You can get the padlock back by installing this add-on: https://addons.mozilla.org/en-US/firefox/addon/padlock-icon/?src=discovery-learnmore
    To reinstate the status bar at the foot of the page (also removed in Firefox 4), install this add-on: https://addons.mozilla.org/en-US/firefox/addon/status-4-evar/

  • How to make this logo effect? Help please!

    How to make this effect? I'm new in illustrator.

    It looks like 3 discs with a 2d image applied to them. I would try the 3d revolve tool to create one, then duplicate it for the other two.

  • How to make Help view well on both laptops and desktops

    Hi -- I'm trying to learn RoboHelp 7 and just created my first WebHelp project. I want to show it to a friend, but don't have a server I can publish it to, so I copied all the files onto my flash drive and put it on my laptop. It all works fine, which is a relief -- however, the custom colors are way off, and some of the screenshots are now too big, so the user would have to scroll (which can be annoying). I created it on my desktop and have been looking at it on a larger monitor (1680x1050), but the laptop is old (1024x768). The thing is, a lot of people might have to view it on 800x600.
    I couldn't find any information in RH's Help about how I should have set it up so that it views well on different systems. I'm hoping someone could please advise me as to what I should have done, and if there's anything I can do now to fix it, or point me to some information. I used Arial 10 pt for the text, and now it looks 12 pt. Should I have made it 8 pt? Is there a rule for how large an image should be to be viewed on a laptop and a desktop?
    One last thing, it's too large to put on a CD, so is does anyone know how to make this into an executable?
    Thanks in advance for any help you can give!
    Daryl

    Hi Daryl
    I use an eBook compiler to convert WebHelp to an executable file. You might investigate eBook compilers for that bit. However, I'm not sure how that would help you since a compiler will do little more than to take a swarm of WebHelp files and store them in a wrapper to create a single file. Generally you will end up with something that although it exists as a single file, is larger than what is inside.
    Are you SURE it's too big for CD? CD will hold 650 megs (700 if you buy the extended types).
    On the screen size issue WebHelp itself should adapt fine. Probably it's the images you are concerned with. And the general rule of thumb is to capture images at a reasonable size to begin with. Never EVER just insert a big ole image into RoboHelp and grab the sizing handle to make it smaller. It will still consume a larger amount of space and the quality will suffer badly. So the best approach is to copy the image at a reasonable size to begin with. Something that may fit nicely in the Topic Pane area as it is presented in the space provided by the lowest common denominator. In your case I believe you said that many are still at 800x600.
    Your 10 point text will still be 10 points at a smaller resolution. It will just look a bit different.
    Hopefully this helps... Rick
    Click here for Adobe Authorized Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Something keeps trying to download on my mac and I don't know what it is. It is not in the apple store and just comes out nowhere and request for my password to download something and I don't know what it is. How to make this stop?

    Something keeps trying to download on my mac and I don't know what it is. It is not in the apple store and just comes out nowhere and request for my password to download something and I don't know what it is. How to make this stop? It pops up every single day.

    Erica,
         I can, with 99.99% certainty, tell you that you are absolutely right in not wanting to download or install this "Helper," whatever it is (but we can be equally certain it would not "help" anything).
         I cannot comment as to Oglethorpe's recommendation of 'adwaremedic'; I am unfamiliar with it.  His links to the Apple discussion and support pages warrant your time and attention.
         It might be really simple -- Trying looking in your Downloads folder, trash anything that you don't know with certainty is something you want to keep, and then Secure Empty your Trash. Then remove the AdBlock extension, LastPass, and Web of Trust extensions to Safari and re-boot. If the issue goes away, still be extraordinarily careful in the future.
         Unfortunately, it's probably not going to be that simple to get rid of, in which case I'd then try the line by line editing in HT203987. 
         I have no further suggestions (other than a complete wipe and re-install...but that's a pain because trying to restore from Time Machine would simply ... restore the Mal).
       For the rest of us, please post when you find a solution.
         Best.
         BPW
      (Also, try to edit your second post -- black out your last name on the screenshot and re-post it for others)

  • After updating my iphone 5s to ios 8.0.2, I am not able to use watsapp and line properly, iphone automatically comes out of the apps after few mins. Please suggest how to fix it.

    After updating my iphone 5s to ios 8.0.2, I am not able to use watsapp and line properly, iphone automatically comes out of the apps after few mins. Please suggest how to fix it.

    I had this same problem with what's app.  There is a new update for the app on the app store which is compatible with ios8.  Update the app, or delete it and re-add it.  I found a lot of apps weren't compliant with ios8, but after updating everything worked fine.

  • Please suggest how can we place chart series label evenly in Pie Chart of SSRS 2008

    Could you please suggest how can we place chart series label value evenly so that it doesnot overlap with each other and user can view the data properly.
    Please find  the attached  screenshot for the same.

    Hi SubhadipRoy,
    As Satish posted, the solution can achieve your goal. In addition, you can right click the Chart Series Labels and Series Label Properties, and then select Number in the left pane, finally select Scientific below the Category option. The data label may not
    overlay. Or you can enlarge the chart.
    Regards,
    Heidi Duan
    Heidi Duan
    TechNet Community Support

Maybe you are looking for