Please critque Function that produces the nextval

Hello,
I realize that this is not a SQL/PLSQL workshop, but I am in need of some assistance with the following code. I am sure it is something that I overlooked or 'just don't understand.'
These 2 functions compiles just fine (scroll down).
CREATE OR REPLACE FUNCTION createSSN_fnc
return VARCHAR2
Is
nSSN VARCHAR2(9);
Begin
Select
'916' || lpad(ssn_seq.nextval, 6, '000')
INTO
nSSN
FROM
dual;
return(nSSN);
end;
CREATE OR REPLACE FUNCTION pg_valid_ssn_fnc
(p_ssn IN VARCHAR2)
return VARCHAR2
IS
lv_valid VARCHAR2(1);
BEGIN
IF
substr(p_ssn,1,3) = '000'
OR
substr(p_ssn,1,3) between '650' and '699'
OR
p_ssn = ' '
OR
p_ssn is NULL
OR
substr(p_ssn,1,3) between '729' and '999'
OR
translate(p_ssn,'012345678', '999999999') != '999999999'
THEN
lv_valid := 'N';
ELSIF
substr(p_ssn,1,3) = '916'
THEN
lv_valid := 'Y';
END IF;
return(lv_valid);
END pg_valid_ssn_fnc;
When I call this function in the following procedure I get these errors. What am I missing here?
CREATE or REPLACE PROCEDURE pgUpdateSSN_prc
AS
cursor student_cur IS
SELECT distinct
ce.student_id,
ce.ssn
FROM
dev_sy_district_defaults sd,
dev_st_enrollment st,
dev_ce_family_member ce
WHERE
     st.student_id = ce.student_id
AND
     st.SCHOOL_YEAR = sd.CURRENT_SCHOOL_YEAR
AND
     st.is_active_ind     = 1
AND
     pg_valid_ssn_fnc(ce.ssn) = 'N';
student_rec student_cur%ROWTYPE;
process_counter NUMBER := 0;
BEGIN
FOR student_rec in student_cur
LOOP
DBMS_OUTPUT.PUT_LINE ('start Updating Students');
UPDATE
dev_ce_family_member
     SET
     ssn = createSSN_fnc(ssn_seq.nextval)
WHERE
     pg_valid_ssn_fnc(student_rec.ssn) = 'N';
process_counter := process_counter + 1;
END loop;
COMMIT;
DBMS_OUTPUT.PUT_LINE ('Total records Processed: ' || process_counter);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE( 'ERROR:' ||sqlcode || sqlerrm);
END;
LINE/COL ERROR
30/12 PL/SQL: SQL Statement ignored
33/14 PL/SQL: ORA-00904: "CREATESSN_FNC": invalid identifier
33/14 PLS-00306: wrong number or types of arguments in call to
'CREATESSN_FNC'
Thanks in advance!

WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE( 'ERROR:' ||sqlcode || sqlerrm);This is not a good idea.
- DBMS_OUTPUT is a tool for optional debug messages. Depending on what calls the procedure and the settings in place it can often be silently ignored.
- SQLERRM already contains SQLCODE. SQLCODE is just the number at the start of SQLERRM. Why would you duplicate it?
- Without any exception handler, PL/SQL's default behaviour is to let an exception propagate up to the caller. Writing your own exception handler to catch all exceptions and do less with them is in effect an exception hider.

Similar Messages

  • I was trying to upgrading my iphone 4 to isos 5. But my phone went blank after syn and it say Sim not valid. Please help me, that's the only phone i have.

    I was trying to upgrade my iphone 4 to the isos 5, everything was done on the PC. After it was done i thought it was working,but the screen went blank and this wat it says. SIM not Valid... please help me, that's the only phone i have.

    If your iPhone was hacked to be unlocked to use with any carrier's SIM card, you just re-locked the iPhone to the carrier the iPhone was sold as carrier locked when new.

  • Functionality that select the current tag

    I am trying to add functionality that selects the current
    tag. Like the tag editor does, but without the pop-up. I haven't
    got vary far on figuring it out and I would appriciate some help.

    What do you mean by the "current" tag? To me, that means the
    one that is
    already (i.e. currently) selected.
    Randy
    > I am trying to add functionality that selects the
    current tag. Like the tag editor does, but without the pop-up. I
    haven't got vary far on figuring it out and I would appriciate some
    help.

  • Vi or any function that closes the VI abruptly

    Hi,
           Is there any vi or function that stops running the main vi abruptly upon true.(inside the main vi there may be a subvi that has a while loop meaning it runs indefinitely)
                           only the main vi should be closed not the LabVIEW insatance.I'm using LabVIEW 2009
    Message Edited by Robin Hood on 03-11-2010 06:50 AM
    Regards
    RobinHood

    There are several options for this, depending on the overall architcture of your software. Most often, such a request makes sense in a producer/consumer environment.
    So the task is to inform the producer and the consumer to shutdown. Even there you have different options:
    a) The producer inits the shutdown. This is very easy since it follows the idea of produce/consumer.
    b) If the consumer should init the shutdown, you have to include a "messaging mechanism" for the consumer in order to shutdown the producer. Custom user events come quite handy here....
    c) You have some kind of watchdog for this feature. The watchdogs takes care about shutting down other parts of the application using user events or notifications. This can be used in producer/consumer as well as in other design patterns.
    Sure, the shutdown is not really "immediate", but if there are certain security requirements involved (e.g. robotics emergency shutdown), you must not have a software shutdown working within non-deterministic systems! If you have such an environment, the only acceptable "softwaresolution" would work on FPGAs.......
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Looking for a function that returns the currently opened document type

    Dear SAP gurus
    I have a user exit for transaction VA02. In VA02, when I click on button (Item details-configuration),
    it launches a URL in a browser. I am asked to add to the URL, values like Document Type, Document Number
    and Line Item Number.
    I can get Document Number and Line Item Number from the presently opened Sales Document by using the standard Function 'CUCB_GET_OWNER_OF_CFG'.
    However, I am not able get the value of Document Type. Is there any function that will give me
    the value of the Document type of the present document that is open.
    Any feedback/Suggestion will be highly appreciated.
    Thanks
    Ram

    If you're in a VA02 user exit, the document type should be in VBAK-AUART, if I remember the field name correctly.  I would think that ANYWHERE in VA02, that field will be available to you.
    If you want the text of the document type, forward navigate from vbak-auart data element to the domain and look at the values...there'll be a config (T) table (and you may need to add T to the end to get the associated text table) that describes the document type in your system's language,  like:
    E OR   Order
    or something like that...  Sorry, in my installation, we don't use the logistics modules, so I'm writing from memory.

  • How can I turn off the function that touch the top of the screen then turn to the top of the page automatically

    I know the I pad have a function that when you touch the top of the screen, the page will turn to the top automatically. But this function always make trouble. Especially when you are reading some long papers. I would like to turn it off. What can I do ? Thank you!

    It's not something that you turn off, there isn't a setting for it, you will just have to try to avoid touching the top part of the screen. Apart from that you can try leaving feedback for Apple : http://www.apple.com/feedback/ipad.html

  • Is there any function that returns the latest DDL statement

    can anyone tell me if there is any FUNCTION that returns latest DDL statement performed in a schema.
    OR
    if there is any TABLE that will be populated with latest
    DDL statement in schema.
    THANK YOU.

    The table all_objects (and/or dba_objects) contains a column called last_ddl_time. Thus, a query like
    scott@jcave > SELECT max(last_ddl_time)
      2  FROM all_objects
      3 WHERE owner = 'SCOTT';
    MAX(LAST_DDL_TI
    28-NOV-03will tell you the last time any object owned by SCOTT had DDL issued against it.
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com/askDDBC

  • I just downloaded iPhoto 11 on my Mac and used the Import Pictures function that imported the photos, but I can open them in iPhoto. What do I need to do to resolve the problem?

    I just downloaded IPhoto '11 for my iMac and updated my OS X to 8.2. I used the Import to Library function in iPhoto and the photos appeared to be importaing,however, the photos do not appear when I select last import or any other option in th eiPhoto menu. What do I need to do?

    I used the Import to Library function in iPhoto and the photos appeared to be importaing
    What were you trying to import and from where?  You weren't trying to import an existing library into a new one were you? That is the wrong way to update a library!
    When upgrading iPhoto just open the old library with the new application and let iPhoto update the library.
    If that's not what you did explain in detail the workflow you followed after installing the new version of iPhoto.
    OT

  • Function that returns the date/time ?

    We would like to make a validation in the Activity status based on the activity End Time.
    Pls... is there a function that returns something that I could compare with: "8/6/2009 01:00 PM" ?
    I know of Today but I understand that today() returns just the day (no time).
    Txs.
    Antonio

    Hi Antonio,
    You can try using the function -: Timestamp()
    To quote the CRM On Demand help files...
    "+The Timestamp function in Expression Builder returns the server date and time converted to the current user's time zone setting. For example, if the current user's time zone setting is set to Eastern Daylight Time (EDT) -0400 UTC, the Timestamp function converts the server time to EDT. The TimeStamp function performs UTC (universal time code) conversion. NOTE: Arithmetic operations (for example, add or subtract) are not supported with the Timestamp() function.+"
    Hope this helps.
    Regards,
    Cameron

  • Function that finds the absolute path of a file

    Hi,
    I'm creating an application using the SDL framework.
    The following code gives me the absolute path for the file "caisse.jpg", which is located in my application bundle. Then, I can use the value of "cstrURL" to load the image with IMG_Load(cstrURL);
    #import <CoreFoundation/CoreFoundation.h>
    int main(int argc, char *argv[])
    CFURLRef url = CFBundleCopyResourceURL( CFBundleGetMainBundle(),
    CFSTR("caisse"),
    CFSTR("jpg"), //extension du fichier
    NULL );
    const char* cstrURL = CFStringGetCStringPtr(
    CFURLCopyFileSystemPath(url,kCFURLPOSIXPathStyle),
    CFStringGetSystemEncoding()
    printf("URL: %s", cstrURL);
    return EXIT_SUCCESS;
    But I have many files to load for my application. I tried to create a function that would take as parameter informations about the image, and then automatically find the absolute path of this image.
    ( void imgPath(char name[], char ext[], char destination[] ---> name = "image", ext = "jpg", destination is a variable in which the function puts the absolute path of the file)
    How can I do that? What bugs me is the use of the CFSTR macro in the code I have...
    Thank you very much
    FRANKY

    The CFSTR macro can only use a constant string as parameter, not a variable one.
    You can use instead CFStringCreateWithCString if the parameter is a C String (char *).
    Additionaly, I think the input parameters of your imgPath function must be of char* type, not char. And the output parameter char** (but it would be easier to know with the function source code).

  • Function that return the results of a select

    Hi,
    I would like to create a function on the famous HR oracle Departments table to select * from it. I don't know how to do it.
    Does anybody can help me?.
    Thank you

    Oracle stored functions cannot directly return result sets but can return REF CURSOR. Please read [Optimize Result Set Retrieval Using ODP.NET and Ref Cursors |http://www.oracle.com/technology/pub/articles/mastering_dotnet_oracle/williams_refcursors.html] which gives full examples in PL/SQL for server side and in VB. Net for client side.

  • BAPi/call function that calculates the pricing condition in CRM order

    Hello Experts,
        Can anybody suggest me which BAPI to be used in order to recalculate the pricing condition that is already maintained in the CRM order.
    I'm trying to upload .txt file which contains basic price value ( condition type ZPR0 ) to update in the order. This new value should over write the existing one in the CRM order & recaluclate the tax & other condition types in the pricing procedure. Can anybody suggest me how to go abt.
    Regards
    Devika.S
    Edited by: Devika.S on Apr 7, 2009 7:07 AM

    Hi Devika,
    Can you have a look at these two BAPIs as listed below to see if any of them fits your requirement?
    BAPI_BUPA_FRG0030_ADD - Add pricing data
    BAPI_BUPA_FRG0030_CHANGE - Changing pricing data
    Hope this helps,
    Cheers,
    Sougata.

  • Passing parameter for the bean function that deletes record from DB

    I need to delete some record from the DB without updating the reset of the user screen.
    I use commandButton with immediate attribute as true, because validation should be skipped.
    So, I can't rely on backing bean values being updated, but need to pass a param to the function that does the delete (deleteTemplate) function below.
    The value of this param is selected value in another comboBox called "template".
    Code below is not parsing. Could you advise how to do it?
    <a4j:commandButton id="deleteTemplate" value="Delete"
                             action="#{qtBeanParam.deleteTemplate(param['piPerformanceReturnsForm:template'])}" immediate="true" reRender="template,templateList,templateOwner,templateOwnerList"
                             styleClass="blue-button">
                        </a4j:commandButton>Error Parsing: #{qtBeanParam.deleteTemplate(param['piPerformanceReturnsForm:template'])}

    Thank you for your reply.
    Could I pass the value that is entered in some other field as a "parameter" though?
    <f:param name="anyName" value="parameter" />
    For example the value from the following comboBox?
    <rich:comboBox id="template" width="250" value="#{qtBeanParam.templateName}" enableManualInput="true"
                                  converter="#{templateConverter}" valueChangeListener="#{qtBeanParam.changeTemplate}" >
                                  <a4j:support event="onselect" reRender="template,templateList" ajaxSingle="true" />
                                  <a4j:support event="onchange" reRender="template,templateList" ajaxSingle="true" />
                             <f:selectItems id="templateList" value="#{qtBeanParam.templateList}" />
                        </rich:comboBox>

  • How to dispatch the result from test cases to the function that loads

    Hi ,
         I am currently working on writing a test case and i ant to execute the test case and the result of the test cases needs to be returned to function that loads the swf file using loader.
    Below is the structure
    1) Project A
             Has a action script file that has a loader which inturn loads the swf file.
    public function testRunner():void {
                loader = new Loader();
                loaderDispatcher = loader.contentLoaderInfo;         
                sharedEvents = loaderDispatcher.sharedEvents;
                parentURL = loaderDispatcher.loaderURL;
                parentDomain = URLUtil.getServerNameWithPort(parentURL);
                parentScheme = URLUtil.getProtocol(parentURL);
                load("http://localhost:8000/abc.swf");
        var callback:Function = addAsync(onMessage, 30000, {}, handleTimeout);
        sharedEvents.addEventListener("message", callback);
        /*Listener added to receive message event*/
        sharedEvents.addEventListener(MessageEvent.MESSAGE, onMessageEvent);
            private function load(location:String):void {
                // create SWF loader
                loaderDispatcher.addEventListener(Event.OPEN, onOpenEvent);
                loaderDispatcher.addEventListener(Event.INIT, onINIT);
                loaderDispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, onStatus);
                loaderDispatcher.addEventListener(Event.COMPLETE, onComplete);
                loaderDispatcher.addEventListener(IOErrorEvent.IO_ERROR, onError);
                loaderDispatcher.addEventListener(Event.UNLOAD, onUnload);
                loaderDispatcher.addEventListener(Event.CLOSE, onClose);
                var request:URLRequest = new URLRequest(location);
        //request.idleTimeout = 8000;
        try{
    loader.load(request);
    _subMovie.addChild(loader);
           catch (error:Error)
                     trace("Unable to load URL: " + error);
                // listen for DISPATCH events
                sharedEvents = loader.contentLoaderInfo.sharedEvents;
        sharedEvents.addEventListener(DISPATCH_EVENT_TYPE, handleDispatch);
    2) Project B
          Project B has the test cases written and teh swf file for this project is abc.swf.
    test.mxml
    public function go():void {
    var core:FlexUnitCore = new FlexUnitCore();
    core.addListener(new TestCaseListener());
    core.run(ABCTest);
    var messageEvent:MessageEvent = new MessageEvent("message","action test","action testing");
    //loaderInfo.sharedEvents.dispatchEvent(messageEvent);
    When I load abc.swf file this inturn call the mxml file which runs the testcases by using the FlexUnitCore .
    What I am looking for is dispatching the result that is available in TestcaseListener to the call of loader ie; in Project A
    public class TestCaseListener extends RunListener  {
    public override function testRunFinished(result:Result):void {
    trace("testRunFinished invoked 1 ::");
    trace("failureCount::"+result.failureCount);
    trace("failures::"+result.failures);
    trace("successful::"+result.successful);
    Is there any way in which i can dispatch the result from testcaselistener to the call where this swf file is loaded .

    Hello Sue,
    I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
    open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
    When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
    Regards
    Marcus

  • Name of domain that produced error

    Hi,
    How can I find out the name of the domain that produced the error?
    Thanks,
    Malini.

    Hi,
    When the ABAP short dump is displayed, choose "Debugger" and then, using the call stack display, select the program ZGUIXT16. Now you can display the value of the field "DOM". This is the name of the domain that produced the error.
    If you have no possibility to invoke the debugger, only the ABAP short dump, then please look at the value of table DD04L. It contains the data element at the time of the breakdown.
    For example, the entry could look as follows:
    DD04L |RESADSGDEMAND  A0000RESA
    The data element in this case  is RESADSGDEMAND. Using the repository information system, you can now find the domain name, which in this case is also RESADSGDEMAND.
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

Maybe you are looking for

  • How to configure a link in a popup window to open a tab in main window.

    I have put videos in popup windows with a link to their relevant main windows. I have used a behaviors extention from adobe to close the popup with the same link button, but the page doesn't open in the main window. Here is the link: <h2><a href="htt

  • Wireless printing help needed

    How do I print wireless to my hp office pro 8500 from my I pad mini, help needed please

  • Intel iMac and H/K Soundsticks

    Everytime my intel iMac wakes from sleep, it doesn't recognize my soundsticks. They're available in the system preferences/sound output, but when I choose them they won't play. The only way to get them to play is to unplug the power to the soundstick

  • Photoshop CS4 Video Card? - Need Display Port

    You folks have been terrific in helping me with this project. For those that have not seen my previous messages, I am building a computer for a friend who uses Photoshop CS4 exclusively for 2D photo work. That's all he uses his computer for, so nothi

  • Are ps cs4 or cs5 accelerates by ati graphics card gpu?

    Hi Guys, Recently, I have purchased notebook ASUS G73JH A1, which comes with ATI Radeon Mobility HD 5870, I have purchased adobe photoshop cs3 long time before, I heard from one of friends, new photoshop cs4 and cs5 accelerates by graphics card gpu,