Sign Up

Hey, Dev!
Are you looking for a forum full of active developers to help you?
So if you want to:
➡️ Get answers for your development issues
➡️ Help others
➡️ Write an article
➡️ Get rewarded for your active participation
Then this place is just for you and it is 100% FREE.

Have an account? Sign In


Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

OrclQA.Com

OrclQA.Com Logo OrclQA.Com Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Blog
  • New Questions
  • Tutorials
    • Oracle
    • Oracle Apex
    • Python
  • Tags
  • Users
  • Badges & Points
  • About
Home/Vinish/Followers Answers
  • About
  • Questions
  • Answers
  • Best Answers
  • Posts
  • Comments
  • Followers Questions
  • Followers Answers
  • Followers Posts
  • Followers Comments
  1. Asked: November 30, 2020

    Primary/Foreign Key Error which

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Added an answer on February 7, 2021 at 3:12 pm
    This answer was edited.

    ... But if you really want to go with custom error handling function, it is enough if you copy Example of an Error Handling Function from Oracle Doc here : Documentation and use it as described in one in your earlier post in this theread. In Oracle doc it's explain in details how to adjust it and whRead more

    ... But if you really want to go with custom error handling function, it is enough if you copy Example of an Error Handling Function from Oracle Doc here : Documentation and use it as described in one in your earlier post in this theread. In Oracle doc it's explain in details how to adjust it and where so that it will serve your need.

    When I used it basicaly as it is, with only 1 small adjustment for I was not patient enough to create my own CUSTOM error table:

            -- If it's a constraint violation like
            --
            --   -) ORA-00001: unique constraint violated
            --   -) ORA-02091: transaction rolled back (-> can hide a deferred constraint)
            --   -) ORA-02290: check constraint violated
            --   -) ORA-02291: integrity constraint violated - parent key not found
            --   -) ORA-02292: integrity constraint violated - child record found
            --
            -- try to get a friendly error message from our constraint lookup configuration.
            -- If the constraint in our lookup table is not found, fallback to
            -- the original ORA error message.
            if p_error.ora_sqlcode in (-1,-2091, -2290, -2291, -2292) then
                l_constraint_name := apex_error.extract_constraint_name (
                                         p_error => p_error );
            
                begin
                    select 'Some ridiculus message becasue I do not have custome message table'
                      into l_result.message
                      from dual;
                exception when no_data_found then null; -- not every constraint has to be in our lookup table
                end;
            end if;
    

    I get this when violating FK:

    I guess it is worth to try each those 2 and use the one that best fits your needs

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  2. Asked: November 30, 2020

    Primary/Foreign Key Error which

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Added an answer on February 7, 2021 at 2:29 pm
    This answer was edited.

    Hi Hussain, I have this simple FORM on page 61 with DELETE button triggering Delete process: BEGIN DELETE FROM DEPT WHERE DEPTNO = :P61_DEPT_DEPTNO; END; :P61_DEPT_DEPTNO is page item labeled Dept Deptno here in the screen and you may see that while trying to fire Delete process I get standard errorRead more

    Hi Hussain,

    I have this simple FORM on page 61 with DELETE button triggering Delete process:

    BEGIN
    DELETE FROM DEPT WHERE DEPTNO = :P61_DEPT_DEPTNO;
    END;
    

    :P61_DEPT_DEPTNO is page item labeled Dept Deptno here in the screen and you may see that while trying to fire Delete process I get standard error.

    Here is the place where validation comes on the stage. In Proccessing section of the page I click Validation and Create Validation:

    1. Type = No Rows returned
    2. SQL Query:
    SELECT NULL FROM EMP WHERE DEPTNO = :P61_DEPT_DEPTNO
    1. Error
      1. Error Message = "This is my custome message I show you to warn you that you can't delete this DeptNo"
      2. Display Location = Inline with Field and in Notification
      3. Server-side Condition
        1. When Button Pressed = Delete

    So now instead of standard error you'll see the one you just created.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  3. Asked: September 30, 2020

    How to check if the entered value does not already exist in Oracle Apex?

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Added an answer on February 7, 2021 at 4:45 am

    Interactive Grid. Solution that I used to find duplicates among newly entered records for the MGR field I wanted to keep unique. Right click on the MGR column and select Create Validation. Type = Function Body (returning Boolean) Language = PL/SQL PL/SQL Function Body: declare ln_count number :=0; bRead more

    Interactive Grid.

    Solution that I used to find duplicates among newly entered records for the MGR field I wanted to keep unique.

    Right click on the MGR column and select Create Validation.

    1. Type = Function Body (returning Boolean)
    2. Language = PL/SQL
    3. PL/SQL Function Body:
    declare ln_count number :=0;
    begin
    	if :APEX$ROW_STATUS = 'C' then
    		select count(*) into ln_count
    		  from APEX_COLLECTIONS
    		 where collection_name = 'EMPLOYEES'
               and c001 = :MGR;
            if ln_count = 0 then
    			APEX_COLLECTION.ADD_MEMBER ('EMPLOYEES',p_c001 => :MGR);
    		else return false;
    		end if;
    	end if;
    end;
    

    I must guarantee my collection exists. To do that I am going to create Dynamic Action with PL/SQL code:

    begin
    APEX_COLLECTION.CREATE_OR_TRUNCATE_COLLECTION(p_collection_name => 'EMPLOYEES');
    end;
    

    Dynamic Action is going to be fired by Event = Save [Interactive Grid] with Fire on Initialization = TRUE (I need it even before the first Save action, just after my page gets loaded).

    Reference:
    APEX Collection.

     

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  4. Asked: November 30, 2020

    Primary/Foreign Key Error which

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Replied to answer on February 7, 2021 at 2:47 am

    I was rather thinking of something like... I have a page item called P10_Serial_Number of Text type and I let user to edit it. My table Products, I insert P10_Serial_Number to, accepts only unique values for the SN field... Is there a way to customize an error message in case unique constraint is brRead more

    I was rather thinking of something like...

    I have a page item called P10_Serial_Number of Text type and I let user to edit it. My table Products, I insert P10_Serial_Number to, accepts only unique values for the SN field... Is there a way to customize an error message in case unique constraint is breached? I tried solution proposed in Foxinfo... but instead of getting what author described as custom error, I get this and that...

    What I am trying to say is that you have your "use case" in front of you, so why not put it here?

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  5. Asked: February 3, 2021

    How to add one column data to another column in same row in Interactive Grid on oracle apex when select row@selector?

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Replied to answer on February 6, 2021 at 12:21 pm
    This answer was edited.

    You just need to remember that what this code actually does is with every selection change it loops through all the records and: IF see selected it set collection  = service charge. (even if collection was modified by user it will still be replaced with service charge with next selection change deteRead more

    You just need to remember that what this code actually does is with every selection change it loops through all the records and:

    1. IF see selected it set collection  = service charge. (even if collection was modified by user it will still be replaced with service charge with next selection change detected)
    2. It reverts all the changes for the remaining records. (it does not only revert collecion charge to its initial value, but it reverts all eddited fields of all unselected records)

    I am not saying it does not do what you wanted, but before you apply it, please analzie it carefully and adjuste it to your needs.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  6. Asked: February 3, 2021

    How to add one column data to another column in same row in Interactive Grid on oracle apex when select row@selector?

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    Best Answer
    goto150 Professional
    Added an answer on February 6, 2021 at 4:37 am

    I have a feeling that you disliked my idea of using Action button:) Maybe this piece of code is going to serve your need. Revert changes for deselected row: var view = apex.region("SID_COLLECTION_LIST").widget().interactiveGrid("getViews","grid"); var model = view.model; var selectedRecords = view.gRead more

    I have a feeling that you disliked my idea of using Action button:)

    Maybe this piece of code is going to serve your need.

    Revert changes for deselected row:

    var view            = apex.region("SID_COLLECTION_LIST").widget().interactiveGrid("getViews","grid");
    var model           = view.model;
    var selectedRecords = view.getSelectedRecords();
    
    model.forEach(function(record,index, id) { 
          var meta = model.getRecordMetadata( id );
          if (selectedRecords.includes(record)){
    		   model.setValue( record, "COLLECTION_AMOUNT",model.getValue( record, "SERVICE_CHARGE" ))
    	   }
    	   else{
    		   if ( meta.updated ) {
    			   if ( model.canRevertRecord( record ) ) {
    				   model.revertRecords( [record] );
    			   }
    		   }    
          }
    }
    );
    
    
    See less
    • 2
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  7. Asked: November 30, 2020

    Primary/Foreign Key Error which

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Replied to answer on February 6, 2021 at 4:29 am

    It would be easier if you were more specific about the case you're dealing with.

    It would be easier if you were more specific about the case you're dealing with.

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  8. Asked: February 5, 2021

    Master Detail View(Report Total is not appearing)

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Added an answer on February 5, 2021 at 1:46 pm

    Check template that is used for your page item, you'll find it in Appearance section. Your label may disappear for instance if you have your template = Hidden and  and  Label Column Span for this Page Item is 0.

    Check template that is used for your page item, you'll find it in Appearance section. Your label may disappear for instance if you have your template = Hidden and  and  Label Column Span for this Page Item is 0.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  9. Asked: November 30, 2020

    Primary/Foreign Key Error which

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Added an answer on February 4, 2021 at 9:33 pm

    Try validations.

    Try validations.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  10. Asked: February 3, 2021

    How to add one column data to another column in same row in Interactive Grid on oracle apex when select row@selector?

    goto150

    goto150

    • Wroclaw, Poland
    • 0 Questions
    • 18 Answers
    • 4 Best Answers
    • 149 Points
    View Profile
    goto150 Professional
    Replied to answer on February 4, 2021 at 3:56 pm

    Hi Hasem, I am not a big fan of overcomplicating simple things, why don't you use a native feature which is revert changes? Action -- > Selections -- > Revert Changes.

    Hi Hasem, I am not a big fan of overcomplicating simple things, why don't you use a native feature which is revert changes? Action -- > Selections -- > Revert Changes.

    See less
    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
1 2

Sidebar

Ask Question
Write a Post
  • Recent
  • Answers
  • Hussain

    Need to displayed Total in Interactive Report

    • 2 Answers
  • sathishkeethi

    APEX - How to Upload & Download Document in my ...

    • 0 Answers
  • Kanshu

    Can you explain this 15 puzzle code in shell script ...

    • 0 Answers
  • Sanjay

    ORA-01034 ORACLE not available

    • 2 Answers
  • afzal
    afzal added an answer STEP -1 CREATE REPORT LIKE-- select SAL AS "SALARY", NVL(COMM,0)… March 2, 2021 at 10:25 am
  • apex4ebs
    apex4ebs added an answer I have used a union in the sql of the… March 1, 2021 at 1:38 pm
  • Eyad
    Eyad added an answer Thank you. I noticed that The type sequence works only… February 28, 2021 at 3:27 am
  • SupriyaJain
    SupriyaJain added an answer Called color_ig_cells() in Page change event. It is working now.… February 26, 2021 at 4:29 pm
  • SupriyaJain
    SupriyaJain added an answer When I toggle between Page Numbers at the bottom of… February 26, 2021 at 3:10 pm

Recent Blog Posts

  • Vinish

    Oracle Apex - Display External File in Region

  • Vinish

    Oracle PL/SQL Download BLOB File to Disk

  • Vinish

    Oracle Convert External File to BLOB

  • Vinish

    Oracle Apex Calendar Example

  • Vinish

    Oracle Apex - Open Modal Dialog Page Using JavaScript

Explore

  • Home
  • Blog
  • New Questions
  • Tutorials
    • Oracle
    • Oracle Apex
    • Python
  • Tags
  • Users
  • Badges & Points
  • About

© 2021 OrclQA.Com. All Rights Reserved. Privacy Policy