In DemoGrid demo, how to commit into Database in datasource ('EMPLOYEES1')? Add commitEmployee, but failed to commit into DB. procedure commitEmployee is begin api_datasource.doCommit('EMPLOYEES1'); adjustPaging; end; Please help. Tks/Ron Lee

asked 31 Oct '12, 18:32

fly0808_3's gravatar image

fly0808_3
113
accept rate: 0%


Hi Ron,

The "EMPLOYEES" datasource definition that is used in this demo is based on query(since departments and employees needs to be joined in this example) , it's not possible to perform insert/update/delete on datasources which is created from query based datasource definitions. In order to perform insert/update/delete on a datasource, it should be created from a datasource definition based on a table or view.

Therefore, to achieve your request;

1- Define a view named "EMP". This view will be used by the "EMPLOYEES" datasource definition

CREATE OR REPLACE VIEW emp (
   employee_id,
   first_name,
   last_name,
   email,
   phone_number,
   hire_date,
   job_id,
   salary,
   commission_pct,
   manager_id,
   department_id,
   department_name )
AS
select emp.EMPLOYEE_ID,
       emp.FIRST_NAME,
       emp.LAST_NAME,
       emp.EMAIL,
       emp.PHONE_NUMBER,
       emp.HIRE_DATE,
       emp.JOB_ID,
       emp.SALARY,
       emp.COMMISSION_PCT,
       emp.MANAGER_ID,
       emp.DEPARTMENT_ID,
       dep.DEPARTMENT_NAME
from EMPLOYEES emp,
     DEPARTMENTS dep
where emp.DEPARTMENT_ID = dep.DEPARTMENT_ID
/

2- Open "EMPLOYEES" datasource definition, select "View" from "Based On" section and select "EMP" from the combobox. Tick "Delete", "Insert" and "Update" checkBoxes to grant necessary DML permissions.

alt text

3- Expand "Columns" node from the tree and select DEPARTMENT_NAME column. Uncheck checkBoxes labeled "Updatable" and "Required".

alt text

You can also check tutorial 5 and tutorial 8 for an example with a datasource definition based on table.

Hope this helps, Ibrahim

link

answered 01 Nov '12, 01:50

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

edited 01 Nov '12, 01:55

Ensure that in your datasource there is a primary key defined, all three checkboxes (insert, update, delete) are checked. There is nothing more to do to post changes. The call to doCommit is enough.

link

answered 01 Nov '12, 01:59

Vlisidis%20Akis's gravatar image

Vlisidis Akis
163120
accept rate: 5%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×85

Asked: 31 Oct '12, 18:32

Seen: 1,511 times

Last updated: 01 Nov '12, 01:59


© Copyright Gerger 2017