I am new to using Oracle, and I am trying to create an add/insert stored pr

I am new to using Oracle, and I am trying to create an add/insert stored procedure for a table. The PROD_CD and PLAN_CD fields in my table can have no value (empty or null) Can you please check my code and let me know what I am doing wrong?
Table definition:
CREATE TABLE DCWEB.USER_PLAN_PREFERENCE
USERID VARCHAR2(40) NOT NULL,
PROD_CD VARCHAR2(9) NULL,
PLAN_CD VARCHAR2(9) NULL,
STATE_LST VARCHAR2(2) NOT NULL,
STATE_NM VARCHAR2(40) NOT NULL,
LST_UPDATE_TS TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL
ALTER TABLE DCWEB.USER_PLAN_PREFERENCE
ADD CONSTRAINT USER_PLAN_PREFERENCE_XPK PRIMARY KEY (USERID, PROD_CD, PLAN_CD);
-- Grant/Revoke object privileges
grant select, insert, update, delete on DCWEB.USER_PLAN_PREFERENCE to HIGGIB1;
Stored Procedure Definition:
procedure setUserPlanPref (
userid in varchar2,
prod_cd in varchar2,
plan_cd in varchar2,
state_lst in varchar2,
state_nm in varchar2
is
currentTimestamp timestamp := current_timestamp;
begin
insert into user_plan_preference (userid, prod_cd, plan_cd, state_lst, state_nm, lst_update_ts)
values (upper(userid), upper(prod_cd), upper(plan_cd), upper(state_lst), upper(state_nm), currentTimestamp);
commit;
exception
when dup_val_on_index then
begin
update user_plan_preference up set
up.userid = upper(userid),
up.prod_cd = upper(prod_cd),
up.plan_cd = upper(plan_cd),
up.state_lst = upper(state_lst),
up.state_nm = upper(state_nm),
up.lst_update_ts = currentTimestamp
where up.userid = upper(userid)
and up.prod_cd = upper(prod_cd)
and up.plan_cd = upper(plan_cd);
commit;
exception
when others then
rollback;
end;
when others then
rollback;
end;
end;
INPUT DATA
I am unable to insert a record calling the stored procedure with values: DCWEB4578, , 2P, CA, CALIFORNIA but when I change to the string "NULL", the insert succeeds. When I try to call the stored procedure to update the inserted record with values: DCWEB4578, "NULL", 2P, CO, COLORODO the update does not happen since I still see the original record in the table. Please advise. Thanks in advance for your help.

938319 wrote:
I am new to using OracleWelcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and ensure you've updated your profile with a real handle instead of "938319".
You'll get a faster, more effective response to your questions by including as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB/version/edition/host OS
<li>Web server architecture (EPG, OHS or APEX listener/host OS)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s)
With APEX we're fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
Thanks for posting the complete code, it makes it so much easier to understand the problem, but always post code wrapped in tags<tt>\...\</tt> tags to preserve formatting and special characters.
and I am trying to create an add/insert stored procedure for a table.Does this have anything to do with APEX, for which this is the forum? General SQL &amp PL/SQL matters should be directed to the {forum:id=75} forum.
The PROD_CD and PLAN_CD fields in my table can have no value (empty or null) Can you please check my code and let me know what I am doing wrong?This:
           commit;
exception
when others then
rollback;
end;
when others then
rollback;Remove it all.
Commits should be issued by end user/client software on completion of a transaction. This means <tt>commit;</tt> should almost never appear in PL/SQL code. The main exception to this is in <tt>dbms_job/secheduler</tt> scheduled processes that have no client or UI. If this code is executed from APEX, then APEX issues more than enough commits anyway.
exceptions are just a way of ensuring your code is buggy.<tt>when others</tt> exceptions are just a way of ensuring your code is buggy.
INPUT DATA
I am unable to insert a record calling the stored procedure with values: DCWEB4578, , 2P, CA, CALIFORNIA but when I change to the string "NULL", the insert succeeds. When I try to call the stored procedure to update the inserted record with values: DCWEB4578, "NULL", 2P, CO, COLORODO the update does not happen since I still see the original record in the table. Please advise. Thanks in advance for your help.With the <tt>commit</tt>s and <tt>when others...</tt> removed from the code you'll have a chance of seeing what's actually happening. Note that the entire procedure can be simplified by writing as a MERGE</tt> statement.

Similar Messages

  • Can not create a new portal using Oracle and the Administration tools.

    Using the Personalization Server admin tool. My database is Oracle 8.0.5
    (NT). I used the db/oracle/create* scripts to the create the necessary
    database tables. I was able to successfully create users, groups, and
    portlets, but when I try to create a Portal I'm getting the following
    exception.
    Any help would be very appreciated.
    Thank you.
    Marko.
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Set scope/description in propertySetBean MyPortal
    propertySetBean creating property set...
    java.lang.NullPointerException:
    at
    com.beasys.commerce.user.jsp.beans.PropertySetBean.copyPropertySet(Pr
    opertySetBean.java:218)
    at
    com.beasys.commerce.user.jsp.beans.PropertySetBean.initializeProperty
    Set(PropertySetBean.java:181)
    at
    jsp._tools._portal._portal_95_new._jspService(_portal_95_new.java:431
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:105)
    at
    weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
    cherImpl.java:143)
    at
    com.beasys.commerce.axiom.jsp.JspServiceManager.service(JspServiceMan
    ager.java:1033)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:105)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
    textImpl.java:742)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
    textImpl.java:686)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
    ContextManager.java:247)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
    a:363)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    result of propertySetBean.createPropertySet(): Error: Property set
    DEFAULTPORT
    AL_SCHEMA copy could not be completed.

    Marko,
    I know I answered you through support, but for the benefit of the newsgroups
    When using Oracle, you must run the sql scripts provided. The
    insert-pzsamples-oracle.sql script is included in the create-p13n-oracle.sql
    scripts. This script includes inserting information into the tables that are
    required for creating new portlets. In particular, inserts to the
    WLCS_SCHEMA table and inserts to the Meta Data tables (*MD*) are required.
    Cindy Eldenburg
    Marko Milicevic wrote:
    Using the Personalization Server admin tool. My database is Oracle 8.0.5
    (NT). I used the db/oracle/create* scripts to the create the necessary
    database tables. I was able to successfully create users, groups, and
    portlets, but when I try to create a Portal I'm getting the following
    exception.
    Any help would be very appreciated.
    Thank you.
    Marko.
    >Set scope/description in propertySetBean MyPortal
    propertySetBean creating property set...
    java.lang.NullPointerException:
    at
    com.beasys.commerce.user.jsp.beans.PropertySetBean.copyPropertySet(Pr
    opertySetBean.java:218)
    at
    com.beasys.commerce.user.jsp.beans.PropertySetBean.initializeProperty
    Set(PropertySetBean.java:181)
    at
    jsp._tools._portal._portal_95_new._jspService(_portal_95_new.java:431
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:105)
    at
    weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
    cherImpl.java:143)
    at
    com.beasys.commerce.axiom.jsp.JspServiceManager.service(JspServiceMan
    ager.java:1033)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:105)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
    textImpl.java:742)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
    textImpl.java:686)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
    ContextManager.java:247)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
    a:363)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    result of propertySetBean.createPropertySet(): Error: Property set
    DEFAULTPORT
    AL_SCHEMA copy could not be completed.

  • How can I get my data from a old iPad to a new iPad using iCloud and not iTunes

    How can I get my data from a old iPad to a new iPad using iCloud and not iTunes

    Restore from the iCloud backup - assuming that you were backing up to iCloud in the first place. If you weren't using iCloud for backup - then you are out of luck.
    If you were backing up to iCloud - you have to erase all contents on the iPad in Settings>General>Reset>Erase all content and settings - before you can restore from the iCloud backup.
    Read this article before you do anything else
    http://gigaom.com/apple/ios-101-set-up-and-restore-from-icloud-backup/

  • I just started using a new version of Illustrator and the text I am creating has a pink box behind, looks to be about the depth of the normal linespace, it is not visible in outline view, only in preview. What is it and how do I get rid of it?

    I just started using a new version of Illustrator and the text I am creating has a pink box behind, looks to be about the depth of the normal linespace, it is not visible in outline view, only in preview. What is it and how do I get rid of it?

    Hi Larry. I see. It is a file I have worked on previously, and the font is Myriad which I though came with the system. I just changed to Myriad Pro and the pink box disappeared. Thanks for the assistance, I know a new thing!

  • I have a new I Pad air and I am trying to use it with a projector and a whiteboard, unfortunately the two are not connecting. Can anyone give me reasons why this might be happening.

    I have a new I Pad air and I am trying to use it with a projector and a whiteboard, unfortunately the two are not connecting. Can anyone give me reasons why this might be happening.

    You can connect via a cable or wireless using an Apple TV.
    http://ipad.about.com/od/iPad_Guide/a/How-To-Connect-Your-Ipad-To-Your-Tv.htm
    Connect an iPad to a Television or Projector
    http://www.everymac.com/systems/apple/ipad/ipad-faq/how-to-connect-ipad-to-tv-te levision-projector.html
    Connecting iPad iPhone or iPod to TV or Projector
    http://www.disabled-world.com/assistivedevices/computer/ipad-tv.php
    iPad Accessories: Connections for a TV or Projector
    http://www.dummies.com/how-to/content/ipad-accessories-connections-for-a-tv-or-p rojector.html
    You may be interested in AirPlay on the Apple TV:
    http://www.apple.com/airplay/
    http://www.apple.com/airplay/
    Alternately, there are Apple Digital AV Adapters for hardwired connections:
    http://support.apple.com/kb/ht4108
    http://support.apple.com/kb/ht4108
     Cheers, Tom

  • I'm new to using iCloud and couldn't find the answer to: how to set my calendar to use the 24 hour clock. Thanks all.

    ?? I'm new to using iCloud and couldn't find the answer to: how to set my calendar to use the 24 hour clock. Thanks all.

    Thanks, David.  i thought i had it set correctly in Preferences in L&R. Being i was wearing my suspenders and belt at the same time i went back to L&R, cleared what was there and re-entered same to include unchecking and rechecking Time Format fgor 24-hour time.   It works now. Thanks again.

  • Amazon using Oracle and IBM?

    http://www.oracle.com/us/corporate/press/017521_EN about Oracle.
    IBM: http://www.crn.com/software/213403896
    Is Amazon using Oracle and IBM Technology with Cloud Computing fow AWS? Amazon Web Services?

    joacimj,
    I have no experience with using Oracle data-type TIMESTAMP WITH LOCAL TIME ZONE, but you asked if there was a "System" property.
    There is "user.timezone".
    Perhaps the following article will be of help:
    http://www.javaworld.com/javaworld/jw-10-2003/jw-1003-time.html
    Good Luck,
    Avi.

  • I just bought a brand new Cannon GL2 camcorder and I am trying to import...

    I just bought a brand new Cannon GL2 camcorder and I am trying to import some video footage into Final Cut Pro version 5.01. Whenever I put up the Log and Capture screen and turn my camcorder on the computer starts to think(the spinning color wheel) and not let me do anything else not even press play unless I completely turn the camcorder off again which defeats the whole purpose of me even importing footage. I don't understand why the Log and Capture screen won't let me import any video my old Sony Digital Hi8 was importing just fine a day ago, but now that I bumped up to the GL2 for some reason the Log and Capture screen isn't doing it's job so well by the computer starting to think(the spinning color wheel) instead of working. I have used the Cannon GL1 in the past and it worked like a charm. So I don't understand why the GL2 wouldn't be any easier? It is just giving me this problem and I don't know wether it's the firewire bus or what? Can someone please help me with my dilemma?

    Ha...ha..very funny...but ah yeah from reading other posts on the "Canon" GL2 I figured out that you can't have multiple devices plugged into the firewire bus at the same time while you're importing video into Final Cut Pro. That's a HUGE bummer...thanks guys for your help you where fast and reliant. But now I have another problem my internal hard drive only has 4 GB out of 75 GB and my applications take up at least 40 GB of space. How am I going to connect my 600 GB external hard drive to the computer and import footage at the same time? Can you guys help me with this now?

  • I just got a new windows 8 laptop and I am trying to install the version of photoshop elements I bou

    I just got a new windows 8 laptop and I am trying to install the version of photoshop elements I bought at Costco on it, and it will not accept the serial number on the package.

    Hi Jglowney,
    Please let me know what error you get while using the serial number to activate.
    You may want to refer : http://helpx.adobe.com/x-productkb/global/error-serial-number-invalid-try.html

  • I have purchased a new mac book pro and I'm trying to install CS6 from old mac. I have installed cs6 upgrade but, software is asking for cs4 number which is not being accepted.

    I have purchased a new mac book pro and I'm trying to install CS6 from old mac. I have installed cs6 upgrade but, software is asking for cs4 number which is not being accepted.

    I should add that it's an HP photosmart 4280.I found it online and it shows the Mac 0SX operating system.

  • Using Elements11 and building Shutterfly book, would like to add photos to back cover ?

    Using Elements11 and building Shutterfly book, would like to add photos to back cover ?

    Found answer
    See http://http://ipod.about.com/od/advanceditunesuse/ss/album_artwork.htm
    It works

  • ODBC ORACLE connection issue when trying to create a datastore. SAP Ds 3.2

    I am at a client and I am trying to create an Oracle data store.  I have an Oracle client installed on my laptop and an ORACLE driver.  I can connect and query Oralce tables using Oralce tools on my laptop.
    When I go to SAP DS to create a datastore I get an error message "Cannot find NT Oracle Server DLL <OCI.dll>  Make sure Oracle has been installed and the PATH variable has been set"
    The PATH is set correctly. 
    Creating a data store using Database Oracle give the above message.
    If I try using ODBC it cannot find the oracle drive in the system list.
    HELP

    Hello
    Are you using a supported version of Oracle?  I hope it's not Oracle 7!
    This is probably an installation issue, where is Data Services installed?  If its Program Files (x86), try re-installing in C:\SAP or similar.
    Your comment <<If I try using ODBC it cannot find the oracle drive in the system list.>>  makes me wonder if the the Oracle client is not installed properly.
    Michael

  • I am creating a form on LiveCycle Designer and I am trying to create a form that has a e-mail submit button.  When the butten is utilized it attaches the form to the e-mail in an plain text .xml format rather than the pdf format.  Is there a quick fix?

    I am creating a form on LiveCycle Designer and I am trying to create a form that has a e-mail submit button.  When the button is utilized it attaches the form to the e-mail in an plain text .xml format rather than the pdf format.  Is there a quick fix?

    Hi,
    You have the choice between xml or pdf, in later versions of designer you can choose with a dropdown on the email button Object palette, the "Submit As";
    In earlier version you had to edit the XML Source and change the format from xml to pdf (or vice-versa);
    Regards
    Bruce

  • I'm using Lightroom cc, I'm trying to create a develop preset. I'm making changes to one photo that I want to apply to many other photos, one of the changes is to blur the background using the adjustment brush. When I am blurring I am going over the photo

    I'm using Lightroom cc, I'm trying to create a develop preset. I'm making changes to one photo that I want to apply to many other photos, one of the changes is to blur the background using the adjustment brush. When I am blurring I am going over the photo several times, when I go to create the preset the adjustment brush is not an option to check. How do I add the adjustment brush to the develop presets. Thanks Ron.

    The adjustment brush cannot be added to a develop preset.
    If you can replace the adjustment brush with a gradient filter or radial filter, you can add those to a dev preset.
    If a gradient filter or radial filter is not an option for you, you can at least create an adjustment preset to remember your brush settings.

  • Recently installed OSX 10.8.2 and found that there was NO ~/Library and when I tried to create one I was told that it already exists.

    Recently installed OSX 10.8.2 and found that there was NO ~/Library and when I tried to create one I was told that it already exists.
    Does anyone know why ?

    It's hidden. Choose Go to Folder from the Finder's Go menu and supply that path to access it.
    (71284)

Maybe you are looking for

  • Looking for a One to Many script to extend the system partition for Windows 7 machines

    Looking for a One to Many script to extend the system partition for Windows 7 machines

  • Installed latest 11.2 Flash Player and drmtest says I need to update

    I installed the latest version of Flash but I still cannot watch video on Amazon Instant.  Contacted Amazon and uninstalled latest version and re-installed old version.  Still didn't work.  I updated Java.  Still didn't work.  I restarted the compute

  • ALV Grid output like FBL5n output

    Hi Gurus, I want to show the ALV output similar to FBL5n output . In my final internal table has 6 records which are belongs to 2 customers. First 2 records are belongs to First custmer and remaining are belongs to 2nd customer, Even i have copied th

  • Untangling Mavericks from iCloud

    I recently updated our Macs from Snow Leopard (10.6.8) to Mavericks (10.9.x). We had skipped Lion and Mountain Lion due to their heavy iCloud entanglement. iCloud syncing is a handy tool for on-the-go metropolitans with high bandwidth, symmetrical in

  • Edit HTML in Blog

    Hi All, Basically I'm fidelling around with the Blog function and I'm trying to add a youtube video to the blog using the HTML code from youtube, and choosing edit html from the toolbar and pasting the code in. When I press save the blog is blank. An