I want single update query without use the function.

I want to update sells_table selling_code field with max date product_code from product table.
In product table there is multiple product_code date wise.
I have been done it with below quey with the use of function but can we do it in only one update query
without use the function.
UPDATE sells_table
SET selling_code = MAXDATEPRODUCT(ctd_vpk_product_code)
WHERE NVL(update_product_flag,0) = 0 ;
CREATE OR REPLACE FUNCTION HVL.maxdateproduct (p_product IN VARCHAR2) RETURN NUMBER
IS
max_date_product VARCHAR2 (100);
BEGIN
BEGIN
SELECT NVL (TRIM (product_code), 0)
INTO max_date_product
FROM (SELECT product_code, xref_end_dt
FROM product
WHERE TO_NUMBER (p_product) = pr.item_id
ORDER BY xref_end_dt DESC)
WHERE ROWNUM = 1; -- It will return only one row - max date product code
EXCEPTION
WHEN OTHERS
THEN
RETURN 0;
END;
RETURN max_date_product;
END maxdateproduct;
Thanks in Advance.

Hi,
Something like this.
update setlls_table st
        set selling_code =(select nvl(trim(product_code)) from 
                              (select product_code
                                      , rank() over (partition by item_id order by xref_end_dt DESC) rn
                                   from product
                               ) pr
                               where rn =1
                                     and pr.item_id = st.ctd_vpk_product_code
                           ) where NVL(update_product_flag,0) = 0 ;As such not tested due to lack of input sample.
Regards
Anurag Tibrewal.

Similar Messages

  • Can I rewrite the following query without using Row_number() function ??!!

    Hello every one, can I rewrite the following query without using the 'ROW_NUMBER() OVER ' part.
    The query is supposed to pull out the records whose CODE is not NULL and has most
    recent date for UPDATE_DATE . The reason I wanted to do this is, When I embed this query
    in between many other queries along with JOINs, My oracle server is unable to execute. So, I thought
    its better to supplant 'ROW_NUMBER() OVER ' logic with something else and try it. .
    SELECT a.* FROM
    (SELECT b.*, ROW_NUMBER() OVER (PARTITION BY b.PIDM
    ORDER BY b.UPDATE_DATE DESC) AS Rno
    FROM
    SELECT *
    FROM SHYNCRO WHERE CODE IS NOT NULL
    )b
    )a
    WHERE a.Rno = 1

    Hi,
    You didn't write over 150 lines of code and then start testing it, did you?
    Don't.
    Take baby steps. Write as little as pssiblem test that. Debug and test again until you have something that does exactly what you want it to do.
    When you have somehting that works perfectly, take one baby step. Add a tiny amount of code, maybe 1 or 2 lines more, and test again.
    When you do get an error, or wrong results, you'll have a much better idea of where the problem is. also, you won't be building code on a flimsy foundation.
    If you need help, post the last working version and the new version with the error. Explain what you're trying to do in the new version.
    The error message indicates line 133. It looks like line 133 of your code is blank. Does your front end allow completely blank lines in the middle of a query? SQL*Plus doesn't by default; you have to say
    SET  SQLBLANKLINES  ONto have a completely blank line in SQL*Plus. (However, lines containing nothing but at commnet are always allowed.)
    You may have noticed that this site normally doesn't display multiple spaces in a row.
    Whenever you post formatted text (such as indented code) on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    The 4 people who posted small code fragments for you to read all did this.  It would be so much easier for people to read your humongeous query if it were formatted.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • I can't print without using the function print as image since i updated my adobe to the latest version online, will this continue is there any solution please help

    It is a real headache , i can't print any file , i see the message no pages selected to print , i have the latest version of adobe 11 thanks

    Hi Tamer,
    Please try repairing Acrobat from the 'Help' menu and check.
    Regards,
    Rave

  • Can u write the following query without using group by clause

    select sp.sid, p.pid, p.name from product p, supp_prod sp
    where sp.pid= p.pid and
    sp.sid = ( select sid from supp_prod group by sid
    having count(*) =(select count(*) from product));
    thru this, we retrieving all the products delivered by the supplier.
    Can you write the following query without using the group by clause

      select sp.sid, p.pid, p.name
        from product p, supp_prod sp
       where sp.pid= p.pid the above query will still retrieve all the products supplied by the supplier. sub-query is not necessary.
    maybe if you can post some sample data and output will help us understand what you want to achieve.

  • Application update without use the Framework

    Hi, all!
    Is there a way to implemente a auto-update feature without
    using the Adobe AIR Update Framework?
    It's because I'm developing into Flash IDE, and seens there
    is only a Flex framework available.
    I also would like to create my own auto-update framework,
    with customized UI and so on.
    Thank you.
    CaioToOn!

    Oliver, so if I understand correctly, the Updater class
    simply let's you call update() to install a new version based on an
    already downloaded AIR file? So the responsibility to check for an
    update and download it is still left up to the developer when
    building the initial app?
    What does the Updater framework provide in addition to this,
    and is there a Flash CS3 compatible framework?
    Also, what is the purpose of the "version" parameter in the
    Updater.update() method, since it has to match the AIR file being
    specified anyway?
    How should the AIR instance know what version to expect in
    the AIR file? Is that also completely up to the developer to
    determine?
    Thanks.

  • Needs  help to retrive the last row in a  select query without using rownum

    Hi ,
    i need to retrive the last row from the select sub query without using rownum.
    is there any other way to retrive the last row other than the below query.
    is that the ROWNUM=1 will always retrive the 1 row of the select query ?
    select from*
    *(select ename from employee where dept_id=5 order by desc) where rownum=1;*
    Please advise.
    thanks for your help advance,
    regards,
    Senthur

    957595 wrote:
    Actually my problem is ithat while selecting the parents hiearchy of the child data using
    CONNECT BY PRIOIR query
    I need the immediate parent of my child data.
    For example my connect BY query returns
    AAA --- ROOT
    BBB --PARENT -2
    CCC --PARENT-1
    DDD IS my input child to the connect by query
    Immediate parent of my child data "DDD" ---> CCC(parent -1)
    i want the data "CCC" from the select query,for that i am taking the last row of the query with rownum.
    I got to hear that using ROWNUM to retrive the data will leads to some problem.It is a like a magic number.I am not sure what the problem will be.
    So confusing with using this rownum in my query.
    Please advice!!!It's not quite clear what you're wanting, but perhaps this may help?
    you can select the PRIOR values to get the parent details if you want...
    SQL> ed
    Wrote file afiedt.buf
      1  select empno, lpad(' ',(level-1)*2,' ')||ename as ename, prior empno as mgr
      2  from emp
      3  connect by mgr = prior empno
      4* start with mgr is null
    SQL> /
         EMPNO ENAME                                 MGR
          7839 KING
          7566   JONES                              7839
          7788     SCOTT                            7566
          7876       ADAMS                          7788
          7902     FORD                             7566
          7369       SMITH                          7902
          7698   BLAKE                              7839
          7499     ALLEN                            7698
          7521     WARD                             7698
          7654     MARTIN                           7698
          7844     TURNER                           7698
          7900     JAMES                            7698
          7782   CLARK                              7839
          7934     MILLER                           7782
    14 rows selected.(ok, not the best of examples as the mgr is already known for a row, but it demonstrates you can select prior data)

  • How can i fetch records from 3 tables in a single query  without using join

    Hi.
    Can any body please tell me <b>How can i fetch records from 3 tables with a single query  without using joins</b>
    Thanx
    prabhudutta

    Hi Prabgudutta,
    We can fetch the data by using the views concept.
    Go throuth this info we can know the how to create view and same like database table only we can fetch the data.
    Views conatin the data at runtime only.
    Four different view types are supported. These differ in the
    way in which the view is implemented and in the methods
    permitted for accessing the view data.
    Database views are implemented with an equivalent view on
    the database.
    Projection views are used to hide fields of a table (only
    projection).
    Help views can be used as selection method in search helps.
    Maintenance views permit you to maintain the data
    distributed
    on several tables for one application object at one time.
    step by step creation of Maintenance view:
    With the help of the table maintenance generator, you are able to maintain the ENTRIES of the table in SM30 transaction.
    It can be set in transaction SE11 - Tools - Table maintenance generator.
    Table maintanance Generator is used to manually input values using transaction sm30
    follow below steps
    1) go to se11 check table maintanance check box under attributes tab
    2) utilities-table maintanance Generator-> create function group and assign it under
    function group input box. Also assign authorization group default &NC& .
    3) select standard recording routine radio in table table mainitainence generator to move table
    contents to quality and production by assigning it to request.
    4) select maintaience type as single step.
    5) maintainence screen as system generated numbers this dialog box appears when you click on create button
    6) save and activate table
    One step, two step in Table Maintenance Generator
    Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.
    Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.
    SM30 is used for table maintenance(addition or deletion of records),
    For all the tables in SE11 for which Table maintenance is selected , they can be maintained in SM30
    Sm30 is used to maintain the table ,i.e to delete ,insert or modify the field values and all..
    It creates the maintenance screen for u for the aprticular table as the maintenance is not allowed for the table..
    In the SE11 delivery and maintenance tab, keep the maintenance allowed..
    Then come to the SM30 and then enter the table name and press maintain..,
    Give the authorization group if necessary and give the function group and then select maintenance type as one step and give the screen numbers as system specified..
    Then create,,,
    Then u will able to see the maintenance view for the table in which u can able to insert and delete the table values...
    We use SM30 transaction for entering values into any DB table.
    First we create a table in SE11 and create the table maintenance generator for that Table using (utilities-> table maintenance generator) and create it.
    Then it will create a View.
    After that from SM30, enter the table name and Maintain, create new entries, change the existing entries for that table.
    Hope this resolves your query.
    Reward all the helpful answers.
    Rgds,
    P.Naganjana Reddy

  • TS4062 My Iphone won't appear in my devices in Itune.... And the WiFi does not work on my phone.... I seems like there is no solution to update my phone to the new ios on my computer or WiFi without using the 3g because of this!!! help me out

    My Iphone won't appear in my devices in Itune.... And the WiFi does not work on my phone.... I seems like there is no solution to update my phone to the new ios on my computer or WiFi without using the 3g because of this!!! help me out

    Hello there, TempestBelcher.
    It seems you've covered all the bases, but feel free to review the iPhone Troubleshooting Assistant for connectivity here:
    Apple - Support - iPhone - Calls Troubleshooting Assistant
    http://www.apple.com/support/iphone/assistant/calls/#section_0
    If you've followed all the instructions then there are a few good recommendations for what to do next in the last step.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro D.

  • I want to download an audiobook, but my daughter has a giftcard credit on the account. How can I download my audiobook without using the money from her giftcard?

    I want to download an audiobook, but my daughter has a gift card on the account.  How can I download my audiobook without using the money from her gift card?

    go directly to your ibook app. and you're going to find it. it's only with ibooks app.
    best
    Olivier
    <Edited by Host>

  • I have some old cd's I have burned on itunes. How can I copy them to my iphone without using the cloud? I donot want to mess with my cloud settings because I am a technophobe . Please be gentle.

    I have some old cd's I have burned onto itunes. Howcan I copy them to my iphone without using the cloud? I donot want to mess with my cloud settings because I am a technophobe. Please be gentle

    Willy, the procdedure you describe works perfectly for AppleTV G1. In fact, I frequently play DTS music discs ripped to my iTunes library as Apple Lossless (ALAC) and synched to the ATV. What happens is that, as far as iTunes and the ATV are concerned, a conventional stereo 16/44 audio file is being played; however my reciever detects the DTS data stream, and instead of outputting static, it decodes the 5.1 channels correctly. This process parallels the way DTS discs were designed to be played back: a conventional CD player is connceted, via digital out, to a DTS-aware reciever/pre-amp and the two channels of static are recognized as 6 channels of DTS-encoded audio.
    However this process will only work if the player (CD, ATV, PC, etc.) sends a "bit-perfect" 16 bit/44.1 khz data stream to the decoding device. In the case of ATV G2 and G3, as has been discussed elsewhere, the unit resmaples all audio - including 16/44 PCM (Redbook CD)  - to 16/48. While this is not a big deal for conventional audio CDs, MP3s, and AAC files, it mangles the fragile DTS datastream and renders it undecodable. The resulting static that you hear is just like the static you would hear if you played a DTS CD on a non-DTS capable system.
    Sadly, I'm not aware of any easy way around this. You could use a program like Foobar (and the DTS plugin) to convert your DTS CDs to 6-ch .wav or .flac file. From there you could transcode the file to AC-3 and then mux it into a video container that ATV supports. You may need add a dummy video track, for iTunes/AppleTV to be ok with the file, though I'm not sure. This may be a lot of work.
    Sorry for the bad news. I wish that the iTunes/ATV ecosystem had better multi-channel audio support.
    Steven

  • I have just updated my 4s to IOS7. and now my battery discharge is significantly increase. With my Iphone fully charged, the battery run out within 6 hours without using the phone at all. Would it be possible to get the IOS 6.1.3 back to my 4S?

    I have just updated my 4s to IOS7. and now my battery discharge is significantly increase. With my Iphone fully charged, the battery run out within 6 hours without using the phone at all. Would it be possible to get the IOS 6.1.3 back to my 4S?

    Hi, thanks for the suggestion. I have tried as you suggested, and when opening the "purchased" apps some have the icloud logo next to them, but I only have "OPEN" against "Find My iPhone". When opening it up, it goes through the same routine; needs to be updated before proceeding, and wouldn't update because I don't have IOS8.
    Anything else I could try, or am I doomed!
    All of your help is much appreciated, thanks

  • Updating without using the updater?

    Hi I was wondering if it is possible to download updates without using the updater as it is for a pc that is not online. Im after 3.2.0 on xp.
    Many thanks

    You can download the Windows updates
    here and the Mac updates
    here.

  • Elements 11 vs 13: how can I add a new place tag to my PSE13 database without using the wretched and totally inadequate map technology  that Elements 13 wants to impose.

    HI,
    I have recently installed Elements 13 having used Elements 11.0 successfully to build a database of 30,000 plus images indexed by place, people, and photo date. Elements 11 allowed me to add new places which are meaningful to me but which are a complete mystery to the mapping technology of Elements 13. For example some years ago I lived in London in a road called Argyle Road. In elements 11 I could enter the place tag as Argyle Road. In Elements 13 I am required to locate Argyle Road on the map, but the map presupposes that the Argyle Road I am referring to is in Ealing in West London. It is not!
      I now live in a place called Broadsands but the Elements 13 Map places this 0.5 miles away from what I would describe as Broadsands.
      So the question: how can I add a new place tag to my database without using the wretched and totally inadequate map technology  that Elements 13 wants to impose.

    Thank you for your quick response, BalusC. I really appreciate your answer.
    Yes, you are right. If I manually code the same amount of those components in the JSF pages instead of generating them dynamically, the server will still run out of memory. That is to say, JSF pages might not accommodate a great deal of concurrent visiting. If I upgrade the server to just allow 1,000 teachers making their own test papers at the same time, but when over 2,000 students take the same questionnaire simultaneously, the server will need another upgrading. So I have to do what you have told me, using JS+DOM instead of upgrading the server endlessly.
    Best Regards, Ailsa

  • HT1752 I recently purchased an old iMac G3 Macintosh. I was wondering, is there a way where I can update it without using an external disc? I've seen the newer Apple products with the dock, if I update my iMac G3, will it have that, and if so, how can I d

    I recently purchased an old iMac G3 Macintosh. I was wondering, is there a way where I can update it without using an external disc? I've seen the newer Apple products with the dock, if I update my iMac G3, will it have that, and if so, how can I do that?

    I was wondering, is there a way where I can update it without using an external disc?
    If you mean the iMac does not have an internal optical drive capable of reading DVDs, the only option requires another Mac with a DVD-capable drive and FireWire ports. Your iMac G3 will also require FireWire ports. Not all G3 iMacs have Firewire. FW started with the Summer 2000 models with 400mHz and faster processors.
    With FireWire, you can use FireWire Target Disk mode to install from a retail OS install DVD in another Mac. If you supplemental info info tells us if you have another Mac with a DVD reader and the FW ports, we can walk you through the process.
    If the iMac has a tray-loading drive, I'd forget it. They are very limited not only in the OS max (10.3.9) but also in RAM capability. Starting with the slot-loading iMac G3s, the max RAM increased to 1 GB (2 X 512MB modlules). Tiger likes 1GB RAM.
    Understand that pre-Intel Macs are getting harder to use. Even with 10.4.11, your choice of browsers is limited (TenFourFox is the most viable option) and the G3s  rudimentary video hardware means web browsing will be choppy at best.
    If you are in the USA, you can try calling the Apple Store (1-800-MY-APPLE) for an OS disk. As recently as Jan 20, someone posted here that they were able to buy Tiger by calling. It was not clear whether the disks were replacement system install/restore disks or full retail install, but it's a free call.
    When you do "About this Mac" to check teh OS verion, also look at the processor speed and tell us what that says. That can help with recommendations for an upgrade path.

  • How to get the update file without using Nokia Sof...

    The network connection is unreliable and downloading the firmware update using PC Suite for my Nokia E90 proves difficult. Does anyone know how I can get the firmware version 300.34.84?
    The trouble is Nokia's Software Updater does not accommodate any slight interruption to the connection during the update process. I will update this discussion with what version of PC Suite I have once I get that info.
    Any help is kindly appreciated

    In fact, it is not Possible to get the update file without using Nokia Software Updater or you should search the net to find the update files in another place and even you get them, you can not use them with NSU.
    You can Update your Device with:
    1 - NSU (Nokia Software Update)
    2 - FOTA (Firmware Over The Air) for FP2 devices ONLY.
    3 - Nokia Care Center
    there is not other way to upgrade.
    Hope useful for u.
    regards
    Nokia N79 4GB
    SW Version: 32.001 RM-348 MEA

Maybe you are looking for

  • Budget exceeded BP604 (when create Invoice)

    Hi All, User got an error message budget exceeded BP604 when create invoice. How can i know what the configuration to check why system check budget( Investment management). I tried to check the configuration in SPRO (Define tolerance limit for availa

  • Satellite P200-RT1 - FN keys don't work after downgrade to XP

    Hi I have a Satellite P200-RT1, PSPBOC. I have downgraded my operating system from Vista to XP. Now I am having a driver issue, I have installed all of the drivers for my computer. I have installed all of the HotKey utilities for my computer as well

  • I reset my Iphone and backed up my pictures in Icloud. How can I get my pictures downloaded in my phone again?

    I reset my Iphone and backed up my pictures in Icloud. How can I get my pictures downloaded in my phone again?

  • No sound in Bootcamp Windows 8.1

    Hi. I recently installed Windows 8.1 on my Macbook Pro, late 2011 model and ran the Bootcamp software. Everything works great except there is no audio playing at all, I have an X mark on the volume control, troubleshooting results in a 'A recent hard

  • Binding a data source with JBoss

    Hello, I want to substitute the default Hypersonic database JBoss uses with another database (PostgreSQL). I created the postgres-ds.xml file with the new data source and deployed it to JBoss. Then I replaced the hsqldb-persistence-service.xml file w