What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.

Mr President.

What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.

--SL_CUSTOMERS table data


INSERT INTO SL_CUSTOMERS VALUES(1,'Kamrul Hasan',NULL,NULL,'Moghbazar', 'Dhaka','0456789123',NULL,NULL,NULL,'Y',NULL);
INSERT INTO SL_CUSTOMERS VALUES(2,'Rabiul Alam',NULL,NULL,'Motijheel', 'Dhaka','0567891234',NULL,NULL,NULL,'Y',NULL);
INSERT INTO SL_CUSTOMERS VALUES(3,'Shahed Hasan',NULL,NULL,'2-G/1,2-2,Mirpur', 'Dhaka','0678912345',NULL,NULL,NULL,'Y',NULL);



CREATE SEQUENCE  "ALIZA"."SL_CUSTOMERS_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER  NOCYCLE ;


CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG 
BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS"   
FOR EACH ROW   
BEGIN   
IF :NEW.CUSTOMER_ID IS NULL OR :NEW.CUSTOMER_ID < 0 THEN  
  SELECT SL_CUSTOMERS_SEQ.nextval   
    INTO :NEW.CUSTOMER_ID  
    FROM DUAL;   
  END IF;   
END;   
/



When I try to insert several records with the seq.nextval it gives error

violation of primary key.

INSERT INTO "ALIZA"."SL_CUSTOMERS" (CUSTOMER_NAME) VALUES ('sdfsd')
ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated
ORA-06512: at line 1




One error saving changes to table "ALIZA"."SL_CUSTOMERS":
Row 4: ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated
ORA-06512: at line 1







Concerning

Mr President.

I find the solution by creating a function before the triiger

as below

CREATE SEQUENCE  "ALIZA"."SL_CUSTOMERS_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER  NOCYCLE ;

CREATE OR REPLACE FUNCTION get_SL_CUSTOMERS_vId RETURN VARCHAR2 AS
BEGIN
   RETURN SL_CUSTOMERS_SEQ.NEXTVAL;

END;
/

CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG
BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS"
FOR EACH ROW
DECLARE
dummy VARCHAR2(200);
BEGIN
  dummy := get_SL_CUSTOMERS_vId();
  :NEW.CUSTOMER_ID := dummy;
END;
/  

It works very well

Thank you all for the suggestions.

Concerning

Tags: Database

Similar Questions

  • I have Adobe Creative suite 2 premium CS2-series does not work when you try to install on a new computer, help!

    trying to install on my new computer did not work because activation is cancled by adobe. Downloaded the adobe CS2 version (https://www.adobe.com/cfusion/entitlement/index.cfm?e=cs2_downloads) and my serial number does not work.

    What can I do?

    You must use the serial number allowing Adobe to the special download version.

    Error: Unavailable activation server | CS2, Acrobat 7, hearing 3 -.

    l http://helpx.adobe.com/x-productkb/Policy-Pricing/Creative-Suite-2-activation-end-Life.htm

  • When you use Internet Explorer, I can upload files to a Web site. This does not work when I use Firefox. I see no differences in the settings. Can someone help me?

    I am simply by changing IE to Firefox and would like to get rid of Internet Explorer. But because I need the upliading thing, I have to stick to it.

    Your above posted the details of the system tampon() obsolete show with known risks of security and stability.

    1. Shockwave Flash 10.0 r12
    2. Java plug-in 1.6.0_13 for Netscape Navigator (DLL Helper)

    Update the Java plugin to the latest version.

    Update the Flash plugin to the latest version.

  • When you use Internet Explorer, I can download files from the incredimail site. This does not work when I use Firefox. I see no differences in the settings. Can someone help me?

    I can download IncrediMail gold Gallery when I use internet explore content how I want, but when I use firefox sometimes it allows me to download content from the Gallery, but would not allow me to download more, or he wouldn't let me just download

    • "Clear the Cache": Tools > Options > advanced > network > storage (Cache) offline: 'clear now '.
    • 'Delete Cookies' of sites that cause problems: Tools > Options > privacy > Cookies: "show the Cookies".

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the Add-ons is the cause of the problem (switch to the DEFAULT theme: Tools > Modules > themes).

    • Makes no changes on the start safe mode window.

    See:

  • Question 1: The button "Buy now" does not work when you select a plan. Question 2: Can not select "Monthly Plan" for a "unique App."

    Question 1: The button "Buy now" does not work when you select a plan.

    How to reproduce the problem:

    1. go in terms of pricing and membership creative cloud | Adobe Creative Cloud

    2. choose a plan, then click on 'buy now '.

    3. you go to a blank page instead of the next steps in the payment.

    Question 2: Can not select "Monthly Plan" for a "unique App."

    How to reproduce the problem:

    1. go into "https://creative.adobe.com/plans".

    2. under "Unique App", select a product and then try to select the "monthly Plan" in the second menu drop-down.

    3. for some reason, it isn't get selected and the price is replaced with the ellipsis (...). I expect the monthly price to appear.

    Please notify.

    Thank you.

    Contact adobe during the time pst support by clicking here and, when available, click on "still need help," http://helpx.adobe.com/x-productkb/global/service-ccm.html

  • Here's a strange. I have a HTML page with this time a wmv video. It works perfectly from a USB stick or SD card, but does not work when they are copied to the hard drive

    I have an HTML page created with web expression 4. It contains only a wmv video. It works perfectly when it is called from a USB stick or SD card, but does not work when they are copied to the hard drive. The results are the same with IE and Firefox. It don't make no difference if I use Media Player V9 or V11. He has no control on the page Media Player. Video and html files are in the same directory. Here is the code snippet:

    LIFT, DRAG, THRUST and GRAVITY










    If I run it on a machine with Win 7 there is no problem.

    Richard Grosser

    Hi Richard c. Grosser,.

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the Microsoft Expression forums.

    http://social.expression.Microsoft.com/forums/en-us/categories

  • When I click on any icon in my control panel, a black window opens and C:WINDOWS\system32\rundll32.exe is what's wrong with the system

    When I click on any icon in my control panel, a black window opens and C:WINDOWS\system32\rundll32.exe is what's wrong with the system

    {Assuming the rundll32.exe file is not found}

    See if them can restore the file rundll32.exe:
    http://support.Microsoft.com/kb/812340 Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]

  • try to do an update and it gives me an error code 80240016 and when i run Microsoft solve this trobuleshooter it does not work and tells me an occure\red error.

    try to do an update and it gives me an error code 80240016 and when i run Microsoft solve this trobuleshooter it does not work and tells me an occure\red error. How can I fix it?

    Hello

    1. what patch did you try?
    2. update you are trying to install?

    Method 1:
    You can follow the steps in troubleshooting this article and check:
    Problems with installing updates
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-installing-updates

    Method 2:
    You can also try the steps from the link:
    Windows Update, error 80240016
    Error message when you try to install the updates on the Windows Update Web site or the Microsoft Update Web site: "0 x 80240016.
    http://support.Microsoft.com/kb/957307

    Method 3:
    You can also perform a clean boot, and then try to install and check.
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/kb/929135
    Note: After a repair, be sure to set the computer to start as usual as mentioned in step 7 in the Knowledge Base article.

  • I have firefox 13 and 15 but realplayer download this video option does not work, extensions to save plugin is disabled, if no videos do not play in youtube

    I have Firefox 13 and real player 15, but the download this video option does not work, under extensions to save browser plugin is disabled, but if active videos do not play in youtube, error occurs, it's major drawback, it works well with IE, but I prefer Firefox so any help to rectify the issue is appreciated.

    One possibility is to upgrade to Flash 11.2 and re - activate the Plugin RealPlayer browser Record extension in the Add-ons Manager (Tools > Modules > Extensions) (it's a softblock).

    If you need to return to 11.2 Flash you can download Player Flash 11.2 through this direct link:

    You must uninstall version 11.3 Flash.

  • Why can I no longer right click to get the NewFolder option? I realize now, there is a button for this, but it does not work.

    Why can I no longer right click to get the NewFolder option? I realize now, there is a button for this, but it does not work.

    Hello

    I understand that you are facing problems with the creation of a "New folder" option in the context menu.

    Have you made changes on the computer before this problem?

    I suggest to follow the methods provided below and we update on the State of the question.

    Method 1: I suggest you to follow the steps suggested by "Linda Yan" and check if it helps.
    http://social.technet.Microsoft.com/forums/en-us/w7itproui/thread/9ee6ecdf-5958-4AF4-B640-c659ada57bc4/

    Registry WARNING: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, see this link: http://windows.microsoft.com/en-US/windows7/Back-up-the-registry

    Method 2: If the problem persists, I suggest you follow the steps proposed by "Linda Yan" and check if it helps.
    http://social.technet.Microsoft.com/forums/en-us/w7itprogeneral/thread/97de8a2a-12f2-4381-A409-a78f4ae551cf/
    Hope this information is useful.

  • Updated this AM - now does not work - application on the (0xc000001d) update error

    Updated this AM - now does not work - application on the (0xc000001d) update error

    Now what?

    JohnC salvation,

    For a fix, update for first Pro CC 2015 (9.2).

    Thank you

    Kevin

  • Re: What can I do if Flash player does not work?  Flash player work on Mac?

    March 1, 2015

    I'll just update that I can't really do anything else. I found several other unanswered questions like mine. I found an answer that mentions that it can be the video card in place, so I'll post a screenshot of my information.

    Screen shot 2015-03-01 at 8.45.02 PM.png

    Screen shot 2015-03-01 at 8.44.55 PM.png

    March 1, 2015

    I posted this question 25 and have not yet received response. Because of this problem of crash, I can't do anything on my computer apart from solitaire game and hang out Adobe communities looking for an answer. I found several issues like mine (Mac, firefox, flash player constantly crashing) who have no answers either, and I'm getting upset. I've been floating around Mozilla and Apple Help sections, and there is no answer there either. How can I get an answer? Or is there just no fix for this problem and Flash player does not work on mac more? Y at - it another program that I can use instead of Flash player? I like a lot to an answer, the answer, or anything cause I've stuck here until then. Thank you for you time.

    Here are several reports of incidents:

    BP-0b57d4c3-0df9-4070-950E-835142150301.txt

    BP-35af1213-1ff8-4216-94ff-8d3342150226.txt

    BP-9371e9ab-8388-4138-bf6a-ff7e62150226.txt

    BP-3c28fafa-24f8-400C-9c6c-333e12150226.txt

    BP-5f9a1a2b-5a7c-48ff-8B86-d32502150226.txt

    BP-0d407ea3-045b-4B15-9036-35d112150226.txt

    BP-34c3785b-f5e2-4c98-92b7-d111f2150226.txt

    BP-1cfda1c4-b0ab-4099-9eed-24eee2150226.txt

    BP-d96a272e-7159-4D32-b0c7-ffc0e2150226.txt

    BP-fead3f14-2c7b-404c-ba57-945a82150226.txt

    BP-d671ca47-33f9-4DB5-b2A4-d71bd2150225.txt

    BP-fe7c8af3-FA53-4105-85E5-e9d652150225.txt

    BP-30330112-fc69-4147-987a-cd0762150225.txt

    BP-46df20c3-9367-4F7F-9AD9-3a2872150224.txt

    BP-ea63edb9-AACA-4abe-BE62-3601f2150224.txt

    BP-769269b1-6DDA-46ab-9aa8-9ac912150224.txt

    BP-987770d6-f8cf-4615-994C-24eb72150224.txt

    BP-71328410-afc1-4904-b8ff-1a4b52150224.txt

    BP-363ee02f-9c3d-46A4-aac6-ef48f2140307.txt

    February 25, 2015

    What can I do if Flash Player does not work?

    MacBook Pro 10.6.8

    36.0 Firefox without plugins

    Adobe Flash Player 16.0.0.305

    Hello

    Since last week, Adobe Flash Player did not work on my computer at all. I can't watch videos and a webpage using Flash for accidents of ads.  I tried to use Adblock, thinking at first that the ads were the problem because they froze my computer in the past. There is nothing, so I went through the guide for Flash on the Mozilla Web site problems.  I removed all plugins, disabled acceleration hardware and even uninstalled Firefox and Flash player, then the reinstalled again. Still, it crashes and I don't know what to do anymore.   Is there something that can be done? Thank you for your time.

    Incident reports are:

    EED4D9C6-DF7A-4541-B9BE-D9F85B545DF6.dmp, this one is the most recent.

    EED4D9C6-DF7A-4541-B9BE-D9F85B545DF6-browser.dmp

    97897DC6-023E-46E8-B956-B316941BE1E9.dmp

    97897DC6-023e-46E8-B956-B316941BE1E9-browser.dmp

    5DB17FD7-F568-4E15 - 8 D 31 2E7C38C8BB2D.dmp

    5DB17FD7-F568-4E15-8D31-2E7C38C8BB2D-browser.dmp

    05DD72E2-D111-49D3-93D2-902567F21D8A-browser.dmp

    05DD72E2-D111 - 49 3 - 93D 2 - 902567F21D8A.dmp

    8A3FC15A-FE5F-40A0-B4B4-F3E01BDAC03C.dmp

    8A3FC15A-FE5F-40A0-B4B4-F3E01BDAC03C-browser.dmp

    F1CF597D-8F8C-4CDF-A196-B141F4476AFE.dmp

    F1CF597D-8F8C-4CDF-A196-B141F4476AFE-browser.dmp

    CB635126-64C4-4219-89C9-196EEEB34877-browser.dmp

    CB635126 - 64 c 4-4219-89 C 9 - 196EEEB34877.dmp

    213A8C2C - 4 d 11-447C-90E9 - B9E9831CA46B.dmp

    213A8C2C-4D11-447C-90E9-B9E9831CA46B-browser.dmp

    F7F307FC - 2-4E23-8319 - A0AD4DEA847B.dmp 12D

    F7F307FC-12D2-4E23-8319-A0AD4DEA847B-browser.dmp

    351A53BA-251B-4EC2-8DF4-B442565DB95D-browser.dmp

    351A53BA-251 b-4EC2-8DF4 - B442565DB95D.dmp

    1F9B7047-7CDA-4E45-9639-B3F7FAB79B22.dmp

    1F9B7047-7CDA-4E45-9639-B3F7FAB79B22-browser.dmp

    62AEFB08-2788-479C-A356-F19E407F396F-browser.dmp

    62AEFB08-2788-479C-A356-F19E407F396F.dmp

    19DD0479-258 a - 41 0-9621 - 1D643F2F39A3.dmp

    137DC4C5-181E-4E7D-BEC4-B3B9C2287C6F.dmp

    A73C1A22-CBE2-4CEB-90E9-8D0BC34D4804.dmp

    8340E86D-CC2B-4A97-A3EB-831502FA6786-browser.dmp

    8340E86D-CC2B-4A97-A3EB-831502FA6786.dmp

    EACF0128-7761-4F4B-979D-22EDA2BF571E-browser.dmp

    EACF0128-7761-4F4B-979D-22EDA2BF571E.dmp

    Bug 3947102

    Thank you very much for the help. It seems silly to lead people on the forums if it is not guaranteed help.  I have here a telephone number or an email address instead?

  • Sound does not work when it is connected to the TV with HDMI

    I have a HP Pavilion Notebook PC, DV7 - 6813EV, running windows 7 Home Premium 64-bit SP1. My problem is that I have no sound when connected to my TV HDMI connection and press. Please could someone help me? Thanks in advance

    Hello gematz,

    The sound does not work when it is connected to the TV via HDMI.

    Go to start.

    Type sound.

    Click sound

    On the playback tab, click with the right button on the HDMI interface, and then select set as default device.

    If you do not see the HDMI, right click and select devices see off, then set as default.

    I would like to know how everything goes.

  • Form does not work when it s poses in a movieclip


    I've isolated the problem and it s seems to be concentrated in the path "mcForm.skickat eq 'Yes' below: (the serverside script is done in Php).

    I t looks like that the form does not work when it s respondent in a movie clip called mcForm with a button send simply called 'send '.
    I have to place the form in a movieclip, because the shape is a good interpolation made by Laco interpolation method.

    Everything works fine if ["BOLD"] I have no place [/ bold] form in a movieclip.

    Here´s a part of the actionscript in the script main navigation.swf:

    If (mcForm.skickat eq 'Yes') {}
    gotoAndStop ("labelFinished");
    }

    Here´s actionscript code on the button 'Send' in mcForm in navigation.swf:
    on (release) {}
    loadVariables (" http://www.homesit.se/phpmail.php", "", "GET");
    _parent. Play (); This statement is not the problem.
    }

    The chronology in navigations.swf never reaches the label "finished."

    It works fine if I do not place shape to a movieclip in navigation.swf timeline:

    If (mcForm.skickat eq 'Yes') {//this path is the problem
    gotoAndStop ("labelFinished");
    }

    Here´s in php serverscript:
    (I have no problem here)

    <?
    $headline = "mail from your Homesite.
    $text = "$name sent email you from your homesite.
    It wrote:

    $message
    ";
    mail ($mymail, $headline, $text,
    "To: $email. (' \nReply-to:".$email);
    ECHO ("Send = Yes");
    ? >

    What could possible be wrong

    I appreciate every response.


    The root of the problem (look at the code you posted), it's that there is no event that determines what should happen when your data comes back from PHP. When you use loadvariables, you need an event for mcForm, like our:

    {mcForm.onData = function ()}
    do something
    }

    The problem according to what I see is that on your main timeline code checks the value of mcForm.skickat, but you do not seem to define this variable anywhere. The php script returns a variable named 'send', but I do not see anywhere skickat. If it is not set, its value will be always "not defined".

    To make things more efficient, you should really use loadVars and a reponsed instead of loadVariables Manager. When you use loadVariables, all variables in the clip are sent to your php script that transfer really just data loss. Using loadVars, you specify what vars to send, making the process more efficient. See the docs... everything is in there (with examples).

    BTW... This is the Flash Media Server forum. In the future, you might want to ask questions like this in the general flash or actionscript forum, you will get more answers (more people read on these forums)

  • The slide show feature does not work when I used my Apple TV new 4th gen. I have all the minimum requirements for Macbook and Macbook OSX the Airport express. The slide show starts and stops after that 7 photos are displayed on the TV. If I change the

    The slide show feature does not work when I used my Macbook with new Apple TV 4th gen. The slide show stops after that display 7 photos and display to select the options for the slide show is displayed on the screen. The selected interval was 5 seconds. If the interval is spent in 3 seconds the slide show would work for a time and then to display random images. Has worked with Apple on this issue Support Mike and he managed to reproduce the problem. Since I'm in the return period of 14 days for this product, I returned it to the Apple store

    Welcome to the Apple community.

    After returning, I'm not really clear on what your question.

Maybe you are looking for

  • My screen text flashes no buttons work and touch screen has no answer. Never seen that before?

    The screen of my text is STUCK in flicker. No buttons or touch screen responds so iPhone 6 more does not stop. Just continues flickering. If anyone has experienced this before? Thoughts?

  • Compiled with SDK app 10.3 - is possible to run on 10.2?

    Hey,. I want to use new gcc 4.8 available in the SDK 10.3, I'll be able to compile the application with 10.3 SDK, then run it on the device that is running OS 10.2? I won't use the new 10.3 SDK API.

  • Trying to neighbour my VCS for an external VCS

    I'm trying to my local VCS for an external VCS of the neighbor, but when set up the neighbor as well as the rule of research I can dial is no longer the local alias I've preconfigured only the pseudonym of endpoint devices.

  • Cannot access remote network via VPN

    Hello I'm trying to set up a router vpn access to my office network. The router is connected to the Internet through using pppoe vdsl.There is also a public oriented Web server in the office which must be accessible. I can access the Web server from

  • One of the secondary index is not complete

    HelloI had an entity having 18847 record.  It contains a primary key and secondary keys several.  Since the next release to check, we see it, all indexes are complete except ProductId.  What should I do to fix this error?Verification of data persist