Which solution is better

Hi all ,
I have a table callled preference (usr_id, pref_cd,prod_cd,prod_Fam_cd,updated_date)
user who logs in to the application will set the preference for a product ..
Now Java team wants me to create a stored procedure that accepts array of preference objects(each preference object contains all the fields of preference table) and I have to update/insert the preference table .
I have created the procedure.
But my question is Is this a good way ? cant java code directly access the table tot do this ? why to make it complex to create a stored procedure and create table types and object types which is additional maintenance.
Plz suggest which is the better approach?

raj_fresher wrote:
now I write a function to perform this and this function will have to return some success code(say 0) to the java program if the inserts and updates are successful else i will have to return some failure code (say 1)1) I assume you really mean that you are creating a stored procedure to do the DML, right? Functions should not do DML.
2) Why do you need to return a status code? It is generally far preferrable to throw an exception if a procedure fails than to force every caller of the procedure to add code to check the status code after every call.
Now what condition i have to test for a success or failure when writing a function ?
I used Merge command to insert a record if it is not present or update the record if it is present.
Now I will always pass success only right .... what failure condition should i be checking on in the procedure?The condition you have to test for depends on your requirements. What constitutes success? If doing a merge is appropriate, presumably the Java code doesn't care whether rows were inserted or updated. So success may be that the MERGE statement ran without throwing an exception.
secondly , if it is an oracle error how do i pass on the exception to the java code which is calling this proc?If your procedure throws an exception, that exception will automatically propagate to the Java code. The Java code will get a SQLException with the stack trace and error information.
Justin

Similar Messages

  • Which solution for better perfomance?

    I'm writing java application based on XML. This application have to store very large XML file into DB (XML file is about 1000MB large). My solution is to divide it into smaller (100MB) parts (because of memory resources) and store it in DB. I have one XMLType table based on object-relational storage (so at the end there will be 10 rows each of 100MB size).
    XML file looks like:
    <students>
    <student id="1">
    ...// 5 nested elements or collections of elements
    </student>
    <student id="2">
    </student>
    <student id="3">
    </student>
    </students>
    </students>
    Now I need to get java object Student which correponds to <student>element. My solution is to select whole <student> element and use JAXB to convert it to Java object. While solving a problem with selecting <student> element (just in case you know a solution for my another problem: How to select specific element from a XML document using JDBC? another question raised in my mind.
    Which solution has better performance when I don't need to select relational data but I'm interested in xml fragment?
    1) Use object-relational storage
    2) Use CLOB storage
    As I figured out object-relational storage is better for selecting data like student name. But is it also better when I need whole xml fragment?
    Isn't my solution completely wrong? I'm quite a newbie in XML DB so it's possible that I missed better solution.
    Thanks for any advice

    I don't know which version you have regarding 11g, but probably in this case I would go for a table with a XMLType Binary XML column. To make xpath and other statements perform use Structured or Unstructured XMLIndexes to support your queries. The following has worked for far smaller XML documents but the millions we used were good for a total of >> 1 TB total storage size...
    CREATE TABLE XMLTEST_DATA
    (    "ID" NUMBER(15,0),
          "DOC" "SYS"."XMLTYPE"
    ) SEGMENT CREATION IMMEDIATE
    NOCOMPRESS NOLOGGING
    TABLESPACE "XML_DATA"
    XMLTYPE COLUMN "DOC" STORE AS SECUREFILE BINARY XML 
    (TABLESPACE "XML_DATA"
      NOCOMPRESS  KEEP_DUPLICATES)
    -- XMLSCHEMA "http://www.XMLTEST.com/Schema1.0.xsd"
    --  ELEMENT "RECORD" 
    DISALLOW NONSCHEMA
    PARTITION BY RANGE(id)
    (PARTITION XMLTEST_DATA_PART_01 VALUES LESS THAN  (100000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_02 VALUES LESS THAN  (200000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_03 VALUES LESS THAN  (300000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_04 VALUES LESS THAN  (400000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_05 VALUES LESS THAN  (500000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_06 VALUES LESS THAN  (600000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_07 VALUES LESS THAN  (700000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_08 VALUES LESS THAN  (800000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_09 VALUES LESS THAN  (900000000) TABLESPACE "XML_DATA" NOCOMPRESS
    ,PARTITION XMLTEST_DATA_PART_MAX VALUES LESS THAN  (MAXVALUE) TABLESPACE "XML_DATA" NOCOMPRESS
    CREATE INDEX test_xmlindex on XMLTEST_data (doc) indextype is xdb.xmlindex
    LOCAL
    parameters ('GROUP PARENTINFO_GROUP
                 XMLTable test_cnt_tab_ParentInfo
                ''/RECORD/ParentInfo''
                COLUMNS
                 GroupingID01 VARCHAR2(4000) PATH ''Parent/GroupingID'',
                 GroupingID02 VARCHAR2(4000) PATH ''Parent/Parent/GroupingID''
              ');

  • Which solution is better for schedules task? Console application or windows service?

    I have a "MULTI-LEVEL" XML file that I will be getting on daily basis and I want to accomplish following tasks:
    1) I have to read and parse the "MULTI-LEVEL" XML data
    2) Then I have to set or create some kind of .net service (c#) that read the xml and parse the data once a day (daily)?
    3) Now I have SOAP service from other software where I want to feed this XML data to. The schedules service will compare the XML data with software data and update (or add) based on the comparision.
    For this task, I come to conclusion that there are 2 best ways to do this:
    1) Create a console application and use windows task scheduler to run it everyday
    2) Create a windows service that runs in the background
    Which is a better way (or reliable)  solution to do this task? Please advise

    There are several things to keep in mind when writing an app that is designed to run without a user logged in. One of the most common mistakes is requiring some sort of user input.  Since the task will run without user intervention you don't want
    any sort of calls to Console.ReadLine, MessageBox.Show, etc.  They will cause the task to freeze and eventually need to be terminated.  You also don't want to rely on any sort of desktop apps running since a user may or may not be logged on at the
    time.
    Also be aware that a task can be scheduled to run under any user context.  As such you either need to ensure it runs under an account with sufficient privileges or that your app needs no special privileges.  You mentioned you tried to run it from
    bin\debug but you most likely have your project under your Documents directory.  Only you would have permissions to that folder and therefore will run into issues if the task is run under a different context.  You also mentioned you put it in the
    C:\ but users don't have write privileges to that folder and therefore if you tried to write a file out it would fail. If you need to read/write files then you should pick a common location that all users have access to or at least the one that will run the
    scheduled task. Be aware that, by default, Task Scheduler will not run a task elevated. You need to check the option to run elevated when you configure the user to run the task under.
    One of the key things to ensure you do with a task is verify it is working properly as a normal app.  You should also ensure that you have good logging so that if it does fail you can trace down the failure more easily.  One common thing that people
    tend to do in console apps is put a try-catch around the main function and display a message if an unhandled exception occurs. This is going to cause problems in a task.  Simply log the exception and rethrow it so Task Scheduler will flag the run as a
    failure.
    If you still cannot figure out why your task is failing then please add some logging and then tell us what code is being run at the time and what the failure is.

  • Adobe forms vs website, which solution is better

    Hi experts,
    Please tell me the pro and con of the following 2 solutions:
    Adobe forms
    asp.net call sap web service
    Thanks

    The information below from SAP Help might help you make the decision.
    [http://help.sap.com/saphelp_nw70/helpdata/en/2c/241a427ff6db2ce10000000a1550b0/frameset.htm]
    "We recommend you use interactive forms only after carefully checking the requirements of your application. Interactive forms should only be used if a PDF-based form really does have advantages over a normal Web Dynpro view.  This can include for instance scenarios in which paper-based processes are to be replaced or complimented by an online scenario with exactly the same form layout. Other cases can be applications where, in addition to the online scenario the same form is needed in static form for printing, archiving, sending by e-mail, or for other purposes."

  • Which solution should I adopt? Applet or Java Web Start?

    Hi,
    I am developing a web application which should print cards through a printer in the client side.
    I would like to use a web start aplication to execute JNI calls in client side, but I am considering a possible solution the use of an Applet aplication to execute that.
    My question is "Which solution should I adopt?"
    Thanks a lot in advance.
    Regards.
    Paulo R. A. Sales.
    Software Architect.

    I would go for Java Web Start, since it is:
    a wonderful tool
    easy to use
    gives you full control
    you don't have to start your browser to print them cards
    But wait for better qualified responses as I haven't written an applaet since school.

  • Which Laptop is better? HP DV7-4177NR OR DV7-6B55DX​?

    Okay I need to buy a new laptop ASAP! Can you guys help me and tell me which one is better?
    Both laptops are refurbished.
    DV7 4177NR :http://www.ebay.com/itm/HP-PAVILION-DV7-4177NR-AMD​-PHENOM-II-DUAL-CORE-N640-2-9GHZ-/170872977978?pt=​...
    DV7-6B55DX :http://www.cowboom.com/product/1033798
    Okay well both laptops seem good to me but which one is better?
    The 4177NR features a AMD Phenom II Dual Core N640 @2.9GHZ
    6GB DDR3 RAM
    640GB HD
    BluRay 
    17.3 INCH Screen
    Graphic :ATI Mobility Radeon HD 5470
    Sound :Beats Audio and HP Triple Bass Reflex Subwoofer
    The 6B55DX offers 
    2nd gen intel core i5 -2430 M processor 2.40GHZ with turbo boost to 3 GHZ
    8GB Ram
    Intel HD graphics 3000
    Beats Audio
    etc.
    So which one is better for games? Which one has less problems and wont cause me to spend lots of money to fix in the future?
    I can get the 4177nr for 475 with 10 bucks cash back
    and i can get the other one for around 520. 

    The Intel laptops is probably a better choice. That Radeon HD 5470 is not much powerful and the integrated Intel chip will be better as it uses the advantage of the Sandy Bridge Core i5 processor. However, there are better machines for games than these ones..
    Dv6-7000 /Full HD/Core i5-3360M/GF 650M/Corsair 8GB/Intel 7260AC/Samsung Pro 256GB
    Testing - HP 15-p000
    HP Touchpad provided by HP
    Currently on Debian Wheeze
    *Please, help other users with the same issue by marking your solved topics as "Accept as Solution"*

  • Which phone is better lumia 520, 620, 720 ?

    which phone is better lumia 520, 620, 720. Moreover when 520 and 720 will launched in India and when was 620 was launched & available in india.
    Solved!
    Go to Solution.

    Got this review of Lumia 720 at flipkart.com..an online shopping website in India..how much of this is true??
    i intend to buy a 720 but this...
    "I hate neither Windows 8 nor Nokia. But I really do hate their combination - Nokia Lumia 720. I own this phone for more than a month and now I really want to get rid of this. I want to dicuss only the cons of this phone, as all the pros (if there is any) will be ignored with the intensity of the cons.
    1. No dedicated folder structure. Nothing like a "Gallery" or "My Files". So there is no question of copying files from one folder to another because there is no folder at all.
    2. Its true than you can use a external memory card. But the only action you can perform on the files in your memory card is delete. No copy , paste or even "Rename". If you have to do any of these you have to connect the phone to a Computer.
    3. Yes, Bluetooth is there. But you cannot rename your bluetooth. Ok fine. What is there in a name! But what happens to the files you recieve via bluetooth. If you are lucky, you will find them in your "Saved Pictures" . But in most the cases you wont see your recieved files at all.
    4. You cant download a video file. Its true that there are you tube downloader applications. But you can view these videos only within these apllications . You cant save them to your SD card. Some may ask what is the big issue in it. But guys, these video applications use the phone's internal storage memory and eventually the phone begins to hang.
    5. The most funny thing I found in this phone is "File multiplication". Suppose you took a photograph or downlaoded a music file today. Tommorrow you can see 2 copies
    of it in your phone. The next day 3, then 4 and so on. But if you delete any one of these, all will be gone Dont think that any virus has affected my phone. Bacuse form day 1 its so.
    (Combining points 4 and 5 together and a previous comment. Somebody said its possible to download videos using UC browser. First thing , UC Browser for windows itself is a piece of **bleep**. It hangs every 1 minute. Second, if you download a video and export it your phone, sometimes it gets exported and sometimes not. If luckily it got exported, it begins to multiply as I said in point 5)
    6, The battery. With the internet and all the background tasks OFF, and with no live tiles on the home screen, the maximum time I got with the battery is 11 hours. If i turn all features on, it drains in 5-7 hours.
    7. You cannot open the PDF or .txt files present in your SD card. Only those PDF files you download via internet can be opened. Again you cannot PDFs you download in your SD card.
    8. Applications can be saved to phone only, not in SD card.
    9. I still dont know what is happening to my internal memory and what is occupying it. Anyway its full now. And only thing I could do is to uninstall the present applications.
    10. These comments are from my experience for more than a month. Today I dont have this phone to experience not bacause I sold it, but because its dead now. For any other phone you can try removing the battery, re-inserting it and restarting. But what can you do with this internal battery?????
    Again I want to tell you an awkward experience with this phone. I am a techie and has a habit of listening to music while coding. One day in office, I connected the Nokia headset and started the music. But music was playing via loudspeaker only. It was not recognizing the headset at all. I tried to stop the music. But none of the keys worked, Not the pause button, not the volume keys, not the back button. I tried to switch the phone off. But it didnt work either. I had to cover the loudspeaker with my fingertip for about 10 minutes helpless and suddenly the phone switched off. With relief I removed my fingertips and I couldnt believe what happened . Music was still being played from the Switched Off phone. Again for the next 2-3 minutes I had to cover the loudspeaker before the music stopped. I switched it ON again only after reaching home. If I had sold the phone that day itself. I wouldno have to keep a dead phone now in my hands."

  • N95 Firmware which is much better?

    Im just new here and im being careful..which is much better firmware ? v20 or the latest which is v30? thanks for those who will help
    Solved!
    Go to Solution.

    17-Dec-2008 10:47 AM
    steleece wrote:
    Just by searchin the net, i seen that most people had been able to update there n95-1 to V3 via NSU but when I try there is no update. Ive seen a lot of people saying that v3 is much better and come with rotateme etc..
    There never was a V3. The very first firmware version for the N95-1 was V10. Then there were V11, V12, V20, V21 and the latest is V30. There was a V31 released a few weeks back but it was removed almost immediately.
    If you can't update to V30 it could be because of either or both of these reasons:
    1) You live in a part of the world for which the updated version hasn't yet been translated. For each model there are multiple product codes, each one for a different area and/or mobile network operator.
    2) There is an update available for your part of the world but you have a phone supplied by your operator who hasn't yet approved it. Read this page.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • Which processor is better i5 3230M or i5 4200U?

    Which is the better/faster processor of the two listed? 

    Hi,
    Do you trust the tech guys or the salesmen when talking about technology ? The tech guys who did the review know what they are talking about. Many salesmen/women are good but first of all they look at the buyers to see what the buyers can afford then they will do whatever they can do to get to buyer pockets. Cars, Houses ..... salesmen/women they graduated from the same class.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • I am going to buy a macbook pro for grade 12, and I need to know wheather I should get a macbook pro or a macbook pro retina. If someone could tell me (in a very simple way) which one is,better for me and why, I would be ever so apprreciative.

    I am going to buy a macbook pro for grade 12, and I need to know wheather I should get a macbook pro or a macbook pro retina. If someone could tell me (in a very simple way) which one is,better for me and why, I would be ever so apprreciative.

    Why do you need a expensive MacBook Pro?
    Your attending high school and unless everyone else is rich also your likely going to be a target by the more poorer students for theft or damage to the machine.
    You could keep it home, but if you need it for class then your exposed again.
    Also at that age your not very careful yet, a MacBook Pro is a expensive and easily damaged machine.
    Unless your made of money and so are others at your school, I would recommned a low profile, just does the job cheap Windows PC.
    If it dies, gets lost, stolen or damaged because of your inexperince handling senstivie electronics then it's no big deal.
    You can buy a Mac later on when your sure you have a need for it, currently there isn't much advantage of owning a Mac compared to a PC, they do just about the same things now, one just looks prettier than the other.
    Since 95% of the world uses Windows PC's your going to have to install Windows on the Mac in order to keep your skills up there or be unemployed, so it's a extra headache and expense.
    good luck

  • Which browser is better to use as an option to Safari and how do you download it?

    Which browser is better to use as an option to Safari and how do you safely download it? Thanks

    I use Firefox when a site doesn't work well with Safari. Some people like Google's Chrome, but I find it too instrusive and do not trust Google's security. You can download Firefox from firefox.com.
    Regards.

  • I am looking for macbookpro mid 2010 HDD exact specs so that i can upgrade it to 1TB. PLEASE HELP ME  about OEM apple brand or which one is better.Thanks

    I am looking for macbookpro mid 2010 HDD exact specs so that i can upgrade it to 1TB. PLEASE HELP ME  about OEM apple brand or which one is better?.Thanks

    clintonfrombirmingham Your information is not correct.
    http://kb.sandisk.com/app/answers/detail/a_id/8142/~/difference-between-sata-i,- sata-ii-and-sata-iii
    I have a sata II samsung 5400 rpm and i am only able to transfer at 85 read right speed.
    On my main drive sata III ocz agility 3 ssd i get 120 mb read and 180 write.
    Neither of these come close to the 300 mb promised. So it wont matter if he got sata II or III
    The speed came from Blackmagic Disk Speed Test

  • I would like to buy am Ipad for my nephew. Which one is better to play games, ipad or ipad mini

    I would like to buy an ipad for my nephew. Which one is better, ipad or ipad mini? He wants to play games, and put lots of app.

    Probably the full iPad, because it has a better graphics card. The larger screen helps too.

  • Which is a better bacikup software?

    I'm puzzled as to which is a better backup software:
    Carbon Copy Cloner or
    Super Duper which says it preserves data that would be lost during something called a roll back.
    I don't what that means;
    I am backing up to a firewire external drive, is that a good choice?
    Need advice
    Thanks

    I read in SuperDuper that it completely erases your drive and makes a duplicate of the HD. There are documents that I remove from my HD but would like to keep on the backup disc just in case. I may need them in the future. According to SuperDuper they would be erased because they no longer reside on the main HD. I'm looking to update new and changed items but not delete items that no longer reside on the main HD, am I making myself clear?
    Yes, the free version of SuperDuper! will always erase the target drive and clone the entire source disk again. The paid version will do what you want. What I have in quotes below is directly from the registered version's menus.
    1) Smart Update. "Smart Update will copy and erase what's needed to make the target drive identical to your selections from the source. The result will mimic "Erase, then copy", but will typically take a fraction of the time."
    2) Copy newer files. "Any selected files already on the target drive that are older than the equivalent file on the source will be replaced. New files will also be copied; no files will be removed."
    3) Copy different files. "Any selected files already on the target drive that are different (in date, size or attributes), than the same file on the source will be replaced. New files will also be copied; no files will be removed."

  • c:redirect VS RequestDispatcher -WHICH ONE IS BETTER TO USE?

    WHENVER WE WANT TO ACCESS FILES FROM OHTER APPLICATIONS,WHICH ONE IS BETTER TO USE,<c:redirect> OR
    RequestDispatcher

    Please stop shouting. It is considered rude.

Maybe you are looking for