Wanted - Production Strength Function Example - Best Practices

Hi All,
I'm just starting PL/SQL (transitioning from other languages)
It's recommended that you always use FUNCTIONS + RESULT_CACHE - for performance / abstraction - but the examples shows don't seem to be 'production ready'
For example;
create or replace FUNCTION GET_ACCOUNT
(i1_account_no IN T_ACCOUNT.ACCOUNT_NO%TYPE)
RETURN T_ACCOUNT%ROWTYPE
RESULT_CACHE RELIES_ON (T_ACCOUNT)
IS
account_row T_ACCOUNT%ROWTYPE;
BEGIN
SELECT *
INTO account_row
FROM MDR.T_ACCOUNT
WHERE ACCOUNT_NO = i1_account_no;
END;
RETURN account_row;
END GET_ACCOUNT;
so I presume;
1) I need exception handling / error logging
2) I'd like to return 'more' details to the caller, something like
DECLARE
TYPE io_reply_type IS RECORD
(rcode INTEGER := -1, -- return code
rmsg VARCHAR(2000) := '', -- error message etc
account T_ACCOUNT%ROWTYPE
io_reply io_reply_type;
But there doesn't appear to be a way to define a 'global' record structure - or will using 'packages' allow me to do that.
TIA
Bill
Edited by: 940103 on Jun 12, 2012 3:30 AM

940103 wrote:
1) I need exception handling / error loggingWhy? What are you going to do with which exception? There need to be valid reasons for code to trap an exception. Exception handlers are exceptions in themselves. Most code units do not need it - as most code units cannot fix the exception and has no reason to react to an exception.
2) I'd like to return 'more' details to the caller, something like
DECLARE
TYPE io_reply_type IS RECORD
(rcode INTEGER := -1, -- return code
rmsg VARCHAR(2000) := '', -- error message etc
account T_ACCOUNT%ROWTYPE
);Wrong. This is NOT how error handling works in ANY language.
You either catch the exception and fix it (no error occurred from caller's perspective). Or you propagate the exception up the call stack for the caller to deal with.
Returning an exception as an output variable/record of some type? Wrong in Java. Wrong in .Net. Wrong in C++. Wrong in PL/SQL. This violates the basic principle of coding by contract - by not using the default and robust exception management runtime system that exists, but hijacking that, implementing your own, and creating a gross inconsistent behaviour that the caller does not expect, using data structures that the caller does not know about.

Similar Messages

  • CO-PA: product hierarchy predefined from best practice

    Hi guys,
    unfortunately I have as basis a best practice system, where product hierarchy with 3 levels is already defined in CO-PA:
    PAPH1     ProdHier01-1     ProdH01-1     CHAR     5     MVKE     PAPH1
    PAPH2     ProdHier01-2     ProdH01-2     CHAR     10     MVKE     PAPH2
    PAPH3     ProdHier01-3     ProdH01-3     CHAR     18     MVKE     PAPH3                 
    PRODH     Prod.hierarchy     Prod.hier.     CHAR     18     MVKE     PRODH
    Those ones are already assigned to a best practice operating concern:
    10UK     Best Practices
    1. we have 7 levels in our product hierarchy
    2. I need to read it from mara and not mvke
    When trying to ad product hierarchy as characteristic in KEA5 in our new operating concern, I gut the message below.
    This data element is used in tons of tables and the whole precdure looks risky + after transport I might have issues again?
    Creating ww* characteristics for product hierarchy is not an option, since then I would need to maintain the whole product hiearchy as characteristc values again (like before release 4.5) and this is far more than 1000 entries and is double maintenance after go live.
    Deleting the best practice operating concern is also difficult, since there are several clients where customizing still sits for 10UK.
    Anybody experience? What did you do?
    regards
    Bjoern
    Here is the text from KEA5 when trying to ad mara fields (since date elment lenghts is different due to more levels):
    Product hierarchy field PAPH1 cannot be adapted to the new structure
    Message no. KE691
    Diagnosis
    The definition of the product hierarchy has changed (structure PRODHS). The hierarchy field generated in CO-PA, PAPH1 cannot be adapted to the new definition, because it is already being used in structures or tables.
    System Response
    The field PAPH1 does not appear in the list of fields that can be selected.
    It can no longer be used as a characteristic.
    Procedure
    If you still want to define hierarchy field PAPH1 as a characteristic, proceed as follows:
    1. Display the where-used list for data element RKEG_PAPH1 in database fields using transaction SE12. For hierarchy field PAPH1 to be adapted, a data conversion must be carried out for all the tables listed!
    2. First change the number of characters in the domain RKEG_PAPH1 to match the new definition of the product hierarchy, following the example below. You can do this using transaction SE11.
    Structure PRODHS     Domain
    Field    Length      name       Number of characters
    PRODH1     3         RKEG_PAPH1      3
    PRODH2     2         RKEG_PAPH2      5
    PRODH3     5         RKEG_PAPH3     10
    PRODH4     8         RKEG_PAPH4     18

    Just as Info,
    I needed to go for deletion of those characteristics - quite some work, like:
    1. delete all where-used entries for the characteristics in ALL CLIENTS of this system (important: e.g. planning layout - recommended to change and not simply delete, because the change can be transported)
    2. when then trying to delete characteristics (with "unlock" in KEA0 > value fields) - tons of tables and strucutres popped up, where this data element is still needed - follow note 353257
    3. generate best practice operating concern new (10UK in our case)
    4. create PAPH1 etc. new from table MARA (not mvke in our case - depends)
    all good - hopefully no issues after transport - we will see.

  • Looking for Some Examples / Best Practices on User Profile Customization in RDS 2012 R2

    We're currently running RDS on Windows 2008 R2. We're controlling user's Desktops largely with Group Policy. We're using Folder Redirection to configure their Start Menus as well.
    We've installed a Server 2012 R2 RDS box and all the applications that users will need. Should we follow the same customization steps for 2012 R2 that we used in 2012 R2? I would love to see some articles on someone who has customized a user profile/Desktop
    in 2012 R2 to see what's possible.
    Orange County District Attorney

    Hi Sandy,
    Here are some related articles below for you:
    Easier User Data Management with User Profile Disks in Windows Server 2012
    http://blogs.msdn.com/b/rds/archive/2012/11/13/easier-user-data-management-with-user-profile-disks-in-windows-server-2012.aspx
    User Profile Best Practices
    http://social.technet.microsoft.com/wiki/contents/articles/15871.user-profile-best-practices.aspx
    Since you want to customize user profile, here is another blog for you:
    Customizing Default users profile using CopyProfile
    http://blogs.technet.com/b/askcore/archive/2010/07/28/customizing-default-users-profile-using-copyprofile.aspx
    Best Regards,
    Amy
    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]

  • Creating web page now, want mobile app later.  Best practices?

    I've been writing actionscript on and off for a long time now, but have always used the Flash IDE.  I'm hoping to build my next project using Flex Builder because I'm more of a code jockey than a designer.  I've got Flex Builder 3.
    I'm involved with a modest mobile game project.  We're hoping to build a simple game and it seemed logical to do a quick-and-dirty version of the game in actionscript so the project members and a select audience might be able to evaluate the game dynamics in a browser before we spend a gazillion dollars building the game for iPhone and Android platforms.
    It is my sincerest hope that I might develop my code in Actionscript and MXML and use this code to build mobile apps for iPhone, iPad, and Android without having to rewrite everything in Objective C or Java or whatever other language might be in play at the time we get it finished.
    Q1: Is this possible?
    Q2: Can anyone sketch out for me an overview of the process whereby one exports a Flex project to a mobile app platform?
    Q3: Can any seasoned developers tell me the big "gotchas" to watch out for?  For instance, I'd hate to incorporate a component that would not export to one of the mobile platforms.
    Any help would be greatly appreciated.

    Thanks for your helpful post.  That's encouraging to know that I might be able to get the Flex 4.5 SDK without upgrading my IDE.  I'm a big fan of Eclipse and am considering trying to just use Eclipse with a Flex plugin. I certainly hope I might be able to download the latest eclipse and install a 4.5SDK plugin.  Might as well shoot straight for the latest SDK, right?  It would be great to avoid the $300 investment.
    From your post, it sounds as though the Flex 4.5 sdk will be required for one to access the mobile phone features (gps, camera, accelerometer, etc.) which makes sense.  The ability to go actionscript->mobile was only recently announced.  Personally I think this capability is brilliant on Adobe's part.
    I'm still wondering about the "best practices" aspect. Obviously the idea of a mouseover does not apply in the context of a touchscreen.  As I recall, the events exposed by Cocoa Touch (or other touch screen APIs/libraries) don't have the same Mouse/Pointer events as the AS3 that I know.  The point of this post (which is working well so far thanks for the input) is to try and make sure that I avoid building an app which uses features unavailable in a mobile context.  I'm starting to wonder if skipping the web page advice is being given because they mobile and web page paradigms are so different.
    I still assert that the web page stage would be much easier to bring in testers -- meaning non-technical people who wouldn't know the first thing about installing an app on their phone. I'm talking about an audience of dozens or possibly hundreds and just can't provide them all guidance about getting the app installed.

  • SD EDI with many partners / best practice

    I need some input on how best to approach a large EDI project.
    We will be accepting orders from about 80 customers.  Each one will be drop-shipping products from our warehouse to their customers.  I've set up the config for one location to take advatange of the EDPAR ext/int customer conversion table.  The IDOC uses the sold-to party as the KU type partner profile name (ex. 237661) which allows me to use the EDPAR conversion.  I'm able to get the IDOC processed now through to the finished order.
    Question:  How do I scale this?  Is this the best way to handle 80 partners?  If so, I will have to have one EDI translation per sold-to.  Should we really be hard-coding a sold-to account# as the partner profile name at the EDI translation level or is there a more generic way to handle this?
    It seems like there should be a way to say the partner profile for this customer group is EDIGRP01 and then use the incoming sold-to (ext. customer#) to determine which IDOC partner profile to use OR use user-exits to make that logic happen.  I want to use the configurable best practices here but it sure seems like a lot of work with hard-coded account#'s to boot.
    Thank you for your thoughts.

    Reynolds, the partner profiles are to identify the message type and process code and then function module to post the idocs. These partner numbers will not be used anywhere else. for creating sales orders you need sales area ,sold to and shipto numbers,and material numbers.
       These three values will be converted using the EDPAR and customer material info records.
        Could you please explain why the validation for customer number is required?
    If you really need the customer validation sales order creation automatically do when determining the sales area or material number.
    I question for you. what configuration you did for automatic conversion of external partner numbers into internal customer numbers? does this is used for outbound
    idocs as well? i am doing some outbound messages for orderacknowledgment.
    where i need the external partner numbers to be passed in idoc and edu message.
    but the automatic translation is not taking place? this is also not happening for inbound also for me? Could you please tell what i am missing?
    Please mail me at [email protected]
    Thanks for the help.
    Regards,
    Praveen

  • Discoverer Adm. Best Practices

    Hi All,
    I'm doing a consultancy job for this Company and when they heard I know Oracle Discoverer, they asked me to create some kind of document to evaluate what they have developed here using Discoverer. Plus they want me to create a "Best Practices" document for creating business areas.
    Well... I must confess I don't know discoverer that well ;-).
    So, I'd like to hear from experienced users how you guys do this kind of job. What should I look for to see what is right, what is wrong, what can we do to make it better.. The usual stuff.
    I've been looking for security issues (they grant privileges to users, instead of having roles, etc). But I guess I won't be able to do any report without talking to end-users (those who develop reports using Discoverer Desktop/Plus/whatever...).
    Please, tell me what you think about it and what else shoul I look for. At this moment, I'm not sure where should I point my efforts to...
    Thanks in advance,
    Marcos

    Hey Marcos.
    Big #1 question - are they running Oracle Apps (Enterprise Suite) or not. I'm guessing not as you mentioned roles instead of responsibilities?
    Otherwise - regardless if it's roles or responsibilities (and all my experienced opinion).
    1. Do not grant privs or share bus areas with users - only roles or responsibilites. Why? There's lots of reasons, but for a few, it's way cleaner to have job assignments (roles, etc.) so that when someone moves jobs, promoted, etc., all the existing privs, security keeps on working PLUS you don't have to share workbooks with numerous people, but just their role / resp. Also, when someone leaves, you have have a problem in getting rid of any workbooks they've created - as not even the admin can see a user's report in the database if not shared with them.
    2. Are they using Disco desktop, plus or viewer?
    Now I know some may prefer it differently (had this discussion before on this forum), but if there's lots of users, I try to give Disco Viewer to the vast majority of end users because end users (99% of the time - and I'm sure I'll get slammed for this) - SHOULD NOT BE WRITING REPORTS. Most of the time, they'll screw up and choose too many folders and wonder what a fan trap means, do dumb conditions (such as multiple not ins, multiple queries with %, etc.) and their reports run like a dog.
    For the couple in each department who are tech savvy and want to help others in their department, these ones become power users and they can have Disco Plus or Desktop to create the reports.
    3. Create one user called something like: CORP. This user is (for example), you. With your Discoverer brilliance, you are in charge of creating workbooks that are the CORP standard that work corerctly, look pretty (with corp approved logos, colors, etc.) and are shared with the correct roles / resp. If a power user creates a good report, get them to share it with CORP, you CORP-orize it, check it and it becomes the CORP standard. This alone has worked great in all the Disco contracts I've been on - once the company buys into it.
    4. In the EUL, you try and set up business areas that are logical (ie: either by geographical area (ie: US AR, MX AR, etc.), or by business job (ie: AR, AP, GL), or a combination of both (usually what it evolves to over time).
    5. In the EUl, - if possible - identify the indexes. This makes a huge difference if users can be taught to limit workbooks if at all possible to indexes in a condition. I leanred this long ago with working for years with NoetixViews (a Disco view product) where indexes in folders (ie: pointing to views in the database) are identified with a prefix of A$.
    6. Always, always ... sort your items in the folders in the business area. Sure, if you're using 10+, you can do it automatically, but if a product before (ie: 4i), then do it manually. It sounds dumb, but makes a huge difference for you - and end users - creating reports as you find items way, way quicker.
    That's the first 6. I'm sure more'll be added.
    Russ

  • Best practice - J2EE or standalone ?

    Hi,
    I'm about to install CF7 and want to know whats the best
    practice for deployment.
    Can anyone point me to a summary of the pros and cons of
    CF7/J2EE versus CF7 standalone.
    Thanx.

    It all depends on your website and traffic load. Usually
    standalone should be good enough if your site is small or of medium
    size. Functionality-wise there are no differences between server
    and multi-server installs. However, with multi-server install you
    will be able to setup multiple instances of ColdFusion with each of
    them having a separate Administrator. You will be able to cluster
    those instances if you wish so. Also if you are using more than one
    server, you will be able to cluster across the servers. Another
    advantage of multi-server install is that you get a full version of
    JRun and therefore will be able to deploy and run other Java
    applications on the same platform and same application server. In
    addition you will be able to apply JRun updaters and hot fixes to
    your server. Just a reminder, if you do want to use
    multi-server/J2EE install you need an Enterprise license. Standard
    license will only give you a standalone installation option.

  • Best Practices for Remote Data Communication?

    Hello all
    I am developing a full-fledged website in Flex 3.4 and Zend Framework, PHP. I am using the Zend_AMF class in Zend framework for communicating the data to remote server.
    I will be communicating to database in the following way...
    get data from server
    send form data to server
    send requests to server to get data in response
    Right now I have created just a simple login form which just sends two fields username and password in the method in service class on remote server.
    Here is a little peek into how I did that...
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:RemoteObject id="loginService" fault="faultHandler(event)" source="LoginService" destination="dest">
        <mx:method name="doLogin" result="resultHandler(event)" />
      </mx:RemoteObject>
      <mx:Script>
        <![CDATA[
          import mx.rpc.events.ResultEvent;
          import mx.controls.Alert;
          private function resultHandler(event:ResultEvent):void
            Alert.show("Welcome " + txtUsername.text + "!!!");
        ]]>
      </mx:Script>
      <!-- Login Panel -->
      <mx:VBox>
        <mx:Box>
          <mx:Label text="LOGIN"/>
        </mx:Box>
        <mx:Form>
          <mx:FormItem>
            <mx:Label text="Username"/>
            <mx:TextInput id="txtUsername"/>
          </mx:FormItem>
          <mx:FormItem>
            <mx:Label text="Password"/>
            <mx:TextInput id="txtPassword" displayAsPassword="true" width="100%"/>
          </mx:FormItem>
          <mx:FormItem>
          <mx:Button label="Login" id="loginButton" click="loginService.doLogin(txtUsername.text, txtPassword.text)"/>
          </mx:FormItem>
        </mx:Form>
      </mx:VBox>
    </mx:Application>
    This works fine. But if I create a complicated form which has many fields then it would be almost unbearable to sent each fields as an argument of a function.
    Another method that can be used is using HttpService which supports XML like request and response.
    I want to ask what are best practices in Flex when using remote data communication on a large scale? Like may be using some classes or objects which store data? Can somebody guide me on how to approach data storing?
    Thanks and Regards
    Vikram

    Oh yes, I have done study about Cairngorm, haven't really applied it though. I thought that it helps in separating the data models, presentation and business logic into various layers.
    Although what I am looking for is something about data models may be?
    Thanks and Regards
    Vikram

  • Best Practices for farm naming conventions

    Hi
    I wanted to get some basic best practices and recommendations for farm naming conventions when setting up multiple farms in our environment.
    what are the do's and don'ts?

    First, figure out why you need multiple farms :-)
    I generally name machine accounts based on purpose and location, with a numeral. For example, a SharePoint server in Redmond might be:
    REDSP01, REDSP02, REDSP03...
    And a SQL Server dedicated to this SharePoint farm might be:
    REDSPSQL01, REDSPSQL02...
    If using a SQL cluster, I might use:
    REDSPSQL01A, REDSPSQL01B...
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • APO reporting - Best practice

    Hi,
    I am looking for information regarding best practice and business content for APO reporting (especially within demand planning)in SAP BI. I have found some business content on help.sap.com but it is for example only 2 queries and the project I am working on definitely needs more but they still want to stick to standard/best practices.
    Anyone who can help me or have any ideas?
    regards,
    Malin

    Hi,
    there are 4 data sources for PP/DS:
    0APO_PPDS_OPERATION_01
    0APO_PPDS_ORDER_01
    0APO_PPDS_PROD_CUST_01
    0APO_PPDS_RESCAPREQ_01
    Best regards
    Thomas

  • Best practice for database migration in 11g

    Hello,
    Database migration is required due to OS change.  Here, I have two database instances say A and B in the old server where RDBMS_VERSION is 11.1.0.7.0. They need to be migrated into a new OS where the oracle has been installed with version 11.2.0.2.0.
    Since all data + objects need to be migrated into the new server, I want to know what the best practice is and how to do that. Thanks in advance for your necessary guidance.
    Thanks and Regards,
    Prosenjit

    Hi Prosenjit,
    you have some options.
    1. RMAN Restore: you can restore your database via rman to the new host, and then upgrade it.
        Please follow instruction from MOS Note: RMAN Restore of Backups as Part of a Database Upgrade (Doc ID 790559.1)
    2. Data Guard: check the MOS Note: Mixed Oracle Version support with Data Guard Redo Transport Services (Doc ID 785347.1)
    3. Full Export / Import (DataPump)
    Borys

  • Best Practice of SD

    Hi Friends
    I want to know about <b>best practice</b> in SD.
    Whats that?
    Why we are using that?
    Is it a type of Implementation?
    What are the T-codes in there?
    Any other info.
    Thanks In Advance
    MT

    hi,
    after keen observation of various businesses across different SAP has come out with thebest business practices. In the sense the same is tried to be mapped into SAP. that is the reason sometimes what customers ask for may not be fulfilled as SAP tries to follow the best business practices.
    But not to deny the unique business requirements there are many enhancements provided to meet such requirements.
    you pl go through this link for more on BBP across various industry sectors.
    <a href="http://help.sap.com/content/bestpractices/overview/index.htm">Best business practices</a>
    Pl reward if helpful.
    thanks
    Sadhu Kishore

  • Best Practice Question - Activate Company Code - Open client or transport?

    Hello.
    When activating Company Codes in a newly productive system, is it best practice to do it directly in an open client, or to change the setting via transport?
    Thanks and Regards,
    D Flores

    What do you mean by activating company code?
    Is it productive check box you are talking about in OBY6.
    If so, open client for manual change, make the setting and put it back the client settings.

  • Oracle PL/SQL best practice

    Hello experts,
    Is there any place I could find oracle PL/SQL best practice programming advice?  I got a requirement to write a small paper to help new people that come to work for us so I wanted to put some of best practices (or a set of standard tips) in that along with coding standards etc...
    Best regards,
    Igor

    Hello,
    my first links would be
    Re: 10 database commandments
    On Code Reviews and Standards
    Beware: Any discussion about coding standards tends to get lenghty with flame wars about upper/lower/camelcase keywords, indent style etc :-)
    As stated in the linked document: keep them simple.
    Regards
    Marcus
    Best Practices
    Doing SQL from PL/SQL: Best and Worst Practices
    Naming and Coding Standards for SQL and PL/SQL
    PL/SQL Coding Standards
    Also related:
    Performance question
    Re: How to re-construct my cursor ?

  • MDM MDIS best practices!!!

    Hello Experts,
    I want know what is the best practices of MDIS when MDM connects/imports data from two different ECC instance,
    below is issue which we were facing in our project,
    MDM imports data from two ECC instance, we had maintained two inbound ports 1.ECCCH and 2.ECCCW so when MDM receives bulk files(1000files each file would contain one material record details) from ECCCW then MDIS is scanning and processing only CW port files and same time when MDM receives file from ECCCH then MDIS wont process because MDIS resource is already scanning and processing CW port,
    we are monitoring MDM ready folder through BMC tool when files stuck in ready folder for longer period(30Mint) then tool would generate high level incident so because of above issue now we are getting more high incidents,
    also referred SAP MDIS guide it is also says MDIS process one port at time,
    "If there are multiple files waiting in a port, MDIS imports the files in a
    first in, first out order, meaning the oldest file in the port is imported first,
    then the next oldest, and so on. MDIS imports all of the files that were
    waiting in the port before it imports files from any other port",
    is there any workaround for this issue,
    Regards
    Ajay

    Dear Pramod,
    Pls go throught those links.
    My Best are
    1.       Step by Step approach
    2.       Data Governance
    [Top 10 CDI-MDM Best Practices|http://www.dmreview.com/specialreports/20061019/1064839-1.html]
    [Seven master data management best practices|http://searchsap.techtarget.com/news/article/0,289142,sid21_gci1219185_tax305408,00.html]
    [Technical Best Practices for Master Data Management|http://www.tdwi.org/publications/display.aspx?id=8148]
    Hope this helps,
    + An

Maybe you are looking for