Suppose you have two T-List items in form and you want  to shift element values from one list to another in Oracle Forms, here is the example given below for the same. Create two buttons also between list items as shown in picture in the bottom of this blog. Create one button with label ">" and another with label "<".

When-button-pressed trigger code for button with label ">":

declare
    n number;
    vval varchar2(100);
begin
    --- replace rightsidelist with your list name placed on right side
    --- replace leftsidelist with your list name placed at left side
      n := get_list_element_count('rightsidelist');
      add_list_element('rightsidelist', n + 1, :leftsidelist, :leftsidelist);
      --- delete element
      n := get_list_element_count('leftsidelist');
      for i in 1..n loop
            vval := get_list_element_value('leftsidelist',i);
           if vval = :leftsidelist then
                   delete_list_element('leftsidelist',i);
           end if;
      end loop;
end;

When-button-pressed trigger for button with label "<":

declare
    n number;
    vval varchar2(100);
begin
      n := get_list_element_count('leftsidelist');
      add_list_element('leftsidelist', n + 1, :rightsidelist, :rightsidelist);     
     
      --- delete element
      n := get_list_element_count('rightsidelist');
      for i in 1..n loop
            vval := get_list_element_value('rightsidelist',i);
           if vval = :rigtsidelist then
                   delete_list_element('rightsidelist',i);
           end if;
      end loop;
end;

See also: Create List Item In Oracle Forms


Suppose you want to round the right-angle corners of an image border, set the border value and then use the CSS3 border-radius property along with its browser-specific border-radius properties.


The radius is half the distance of a circle’s diameter and is used to set the amount of curvature on the corner. The higher the value for the radius, the more rounded the corner will be. At the time of this writing, the border-radius property isn’t supported as is; however, the proprietary properties in both Firefox and Safari replicate the effect. The main drawback (other than cross-browser support) is that the names of the border properties are not consistent.



Example

div{
background-image: url(beach.jpg);
width: 375px;
height: 500px;
border: 8px solid #666;
border-radius: 40px;
-moz-border-radius: 40px;
-webkit-border-radius: 40px;
}

Rounded corner property equivalents:













See also: Setting background image with CSS

If the mouse is in an item, SYSTEM.MOUSE_ITEM represents the name of that item as a CHAR value.
For example, if the mouse is in Item1 in Block2, the value for SYSTEM.MOUSE_ITEM is :BLOCK2.ITEM1.

SYSTEM.MOUSE_ITEM is NULL if:
·  the mouse is not in an item
·  the operator presses the left mouse button, then moves the mouse
·  the platform is not a GUI platform

SYSTEM.MOUSE_ITEM examples
/*
Example: Dynamically repositions an item if:
 1) the operator clicks mouse button 2 on an item and
 2) the operator subsequently clicks mouse button 2 on an area of the canvas that is not directly on top of another item.
*/
DECLARE
item_to_move VARCHAR(50);
the_button_pressed VARCHAR(50);
target_x_position NUMBER(3);
target_y_position NUMBER(3);
the_button_pressed VARCHAR(1);
BEGIN
/* Get the name of the item that was clicked.
*/
item_to_move := :System.Mouse_Item;
the_button_pressed := :System.Mouse_Button_Pressed;
/*
If the mouse was clicked on an area of a canvas that is not directly on top of another item, move the item to the new mouse location.
*/
IF item_to_move IS NOT NULL AND the_button_pressed = ’2’
THEN
target_x_position := To_Number(:System.Mouse_X_Pos);
target_y_position := To_Number(:System.Mouse_Y_Pos);
Set_Item_Property(item_to_move,position,
target_x_position,target_y_position);
target_x_position := NULL;
target_y_position := NULL;
item_to_move := NULL;
END IF;
END;

See also: http://www.foxinfotech.in/2015/01/create-xo-checker-game-with-oracle-forms.html


When a query is open in the block, the Post-Query trigger fires each time Form Builder fetches a record into a block. The trigger fires once for each record placed on the block’s list of records.

Usage Notes
Use a Post-Query trigger to perform the following tasks:
·  populate control items or items in other blocks
·  calculate statistics about the records retrieved by a query
·  calculate a running total
·  When you use a Post-Query trigger to SELECT non-base table values into control items, Form Builder marks each record as CHANGED, and so fires the When-Validate-Item trigger by default. You can avoid the execution of the When-Validate-Item trigger by explicitly setting the Status property of each record to  QUERY in the Post-Query trigger. To set record status programmatically, use SET_RECORD_PROPERTY.

See also:
http://www.foxinfotech.in/2013/02/populating-display-item-value-on-query.html
http://www.foxinfotech.in/2014/02/pre-query-post-query-displayitem-oracle-forms.html
Example
This example retrieves descriptions for code fields, for display in non-database items in the current block.
DECLARE
CURSOR lookup_payplan IS SELECT Payplan_Desc
FROM Payplan
WHERE Payplan_Id =
:Employee.Payplan_Id;
CURSOR lookup_area IS SELECT Area_Name
FROM Zip_Code
WHERE Zip = :Employee.Zip;
BEGIN
/*
Lookup the Payment Plan Description given the Payplan_Id in the Employee Record just fetched. Use Explicit Cursor for highest efficiency.
*/
OPEN lookup_payplan;
FETCH lookup_payplan INTO :Employee.Payplan_Desc_Nondb;
CLOSE lookup_payplan;
/*
Lookup Area Descript given the Zipcode in the Employee Record just fetched. Use Explicit Cursor for highest efficiency.
*/
OPEN lookup_area;
FETCH lookup_area INTO :Employee.Area_Desc_Nondb;
CLOSE lookup_area;
END;


You want to place a repeating image at the bottom of a heading, like the cloud as shown below:



Use the background-image, background-repeat, and background-position properties:
h2 {
font: bold italic 2em Georgia, Times, "Times New Roman", serif;
background-image: url(anyimage.jpg);
background-repeat: repeat-x;
background-position: bottom;
border-bottom: 10px solid #666;
margin: 10px 0 0 0;
padding: 0.5em 0 60px 0;
}

You want to stylize the borders on the top and bottom of a heading, as shown below:
Use the border-top and border-bottom properties when setting the style for the heading:
h2 {
font: bold italic 2em Georgia, Times, "Times New Roman", serif;
border-bottom: 2px dashed black;
border-top: 10px solid black;
margin: 0;
padding: 0.5em 0 0.5em 0;
font-size: 1em;
}
p {
margin: 0;
padding: 10px 0 0 0;
}

In addition to top and bottom borders, a block-level element also can have a border on the left and right  sides via the border-left and border-right properties, respectively. The border-top, border-bottom, border-left, and border-right properties are shorthand properties that enable developers to set the width, style, and color of each side of a border.


In all but one browser, styling these new elements is pretty simple. Although you can use the new HTML5 elements now, most browsers even current ones don’t  necessarily understand them. They don’t do anything special with them and treat them like unknown elements you make up.

There is three ways to provide CSS styles for a web page.
Use an external style sheet by coding a link element in the had section

<link rel="stylesheet" href="styles/main.css">

Embed the styles in the head section
<style>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 87.5%;}
h1 { font-size:250%;}
</style>

Use the style attribute to apply styles to a single element.
 <h1 style="font-size: 500%; color: red;"> Valley Town</h1>

The sequence in which styles are applied
1. Styles from an external style sheet
2. Embedded styles
3. Inline style

For internal stylesheets the CSS rules are wrapped within the HTML style element:
<style type="text/css">
<!--
-->
</style>

The style element informs the browser that the content inside the element comprises formatted CSS rules and that the browser should be prepared to process the content. The HTML comment is there to shield older browsers that do not know how to render CSS rules appropriately. For most modern browsers, the HTML comment is no longer needed.
Use different kinds of selectors to target different portions of web pages to style, as shown:
<html>
<head>
<title>CSS Example</title>
<style type="text/css">
<!--
* {
font-family: verdana, arial, sans-serif;
}
h1 {
font-size: 120%;
}
#navigation {
border: 1px solid black;
padding: 40px;
}
li a {
text-decoration: none;
}
p {
font-size: 90%;
}
-->
</style>
</head>
<body>
<h1>Title of Page</h1>
<p>This is a sample paragraph with a
<a href="http://yourlink.com">link</a>. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna <em class="warning">aliquam erat volutpat</em>. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.<p> <ul id="navigation">
<li><a href="http://yourlink.com">Apples</a></li>
<li><a href="http://yourlink.com">Bananas</a></li>
<li><a href="http://yourlink.com">Cherries</a></li>
</ul>
</body>
</html>

I started blogging with Oracle Forms and Plsql examples then also started blogging for Blogger tips and tricks and now after a lot of thinking, I am going to start blogging for HTML5 and CSS3 for web developers and bloggers to get hopefully more visitors and more pages views :)... just joking, I know it is not that easy.

So lets start, here is the first example I am starting for HTML5.

HTML5 The Main Structure

First, the DOCTYPE:
<!doctype html>
That’s it. No URLs that even the most prolific web authors need to cut and paste. Note that there is no version number. That’s all. It’s not so much an instruction as an incantation: it’s required by browsers that need the presence of a doctype to trigger standards mode, and this string is the shortest string that does this reliably.
Unless you can think of a splendid reason not to use it, I recommend UTF-8 as the character encoding:
<!doctype html>
<meta charset=utf-8>

Take a look at that <meta> tag very carefully. Those who are used to writing XHTML will notice three oddities. The fi rst is that the <meta> tag is much shorter than that we have used up until now—we’ve been used to using <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8”>. This is still possible, but the shorter way is preferred as it’s easier to type and works everywhere already. You’ll also notice that I haven’t quoted the attribute charset=”utf-8”. Neither have I self-closed the tag <meta charset=utf-8 />.

So, in the interest of maintainability, we’ll add those optional elements to make what’s probably the minimum maintainable HTML5 page:

<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Interesting blog</title>
</head>
<body>
<p>Today I drank coffee for breakfast. 14 hours later, I went to bed.</p>
</body>
</html>
 

Beginning Google Blogger is an easy-to-read, how-to book about Blogger, loaded with step-by-step instruction and visual aids detailing many aspects of creating and managing a Blogger blog. You will learn basic concepts and advanced techniques, from creating a new blog and selecting fonts and colors to converting the blog to a three-column layout and installing custom blog graphics. You will also learn how to set up a domain name and create a navigational bar.




The following topics will be covered throughout this book:
• Creating a new blog and publishing posts
• Designing a blog, changing its layout, and installing gadgets
• Making money and driving traffic to your blog
• Incorporating social networking tools and search engine optimization tips
• Using a domain instead of the default “BlogSpot” address
• Creating a gallery and knowing how and where to store images online
• Using advanced blog design techniques (HTML and CSS) and customization
• Developing an online store using Blogger pages
• Finding additional help and troubleshooting the most common mistakes

Click here to download this ebook direct from Google Drive

Rs. 163 .Coms at GoDaddy!


Beginning Google Blogger ebook download

Reviewed by Joseph on

Mar 24

Rating:
5

See also: Why And When To Use Pre-Update and Pre-Insert Triggers In Oracle Forms

Pre-Update Fires during the Post and Commit Transactions process, before a row is updated in Oracle Forms. It fires once for each record that is marked for update.

The following example writes a row into an Audit Table showing old discount and new discount for a
given customer, including timestamp and username making the change.
DECLARE
old_discount NUMBER;
new_discount NUMBER := :Customer.Discount_Pct;
oper_desc VARCHAR2(80);
CURSOR old_value IS SELECT discount_pct FROM customer
WHERE CustId = :Customer.CustId;
BEGIN
/*
Fetch the old value of discount percentage from the database by CustomerId. We need to do this since the  value of :Customer.Discount_Pct will be the new value we’re getting ready to commit and we want to record for posterity the old and new values. We could use SELECT...INTO but choose an explicit cursor for efficiency.
*/
OPEN old_value;
FETCH old_value INTO old_discount;
CLOSE old_value;
/*  If the old and current values are different, then we need to write out an audit record */
IF old_discount <> new_discount THEN
/* Construct a string that shows the operation of Changing the old value to the new value. e.g.’Changed Discount from 13.5% to 20%’
*/
oper_desc := ’Changed Discount from ’||
TO_CHAR(old_discount)||’% to ’||
TO_CHAR(new_discount)||’%’;
/*
Insert the audit record with timestamp and user
*/
INSERT INTO cust_audit( custid, operation, username, timestamp )
VALUES ( :Customer.CustId,oper_desc,USER,SYSDATE );
END IF;
END;

Pre-Insert trigger

Pre-Insert Fires during the Post and Commit Transactions process, before a row is inserted. It fires once for each record that is marked for insert.

Example
This example assigns a primary key field based on a sequence number, and then writes a row into an
auditing table, flagging creation of a new order.
DECLARE
CURSOR next_ord IS SELECT orderid_seq.NEXTVAL FROM dual;
BEGIN
/* Fetch the next sequence number from the explicit cursor directly into the item in the Order record. Could use SELECT...INTO, but explicit cursor is more efficient. */
OPEN next_ord;
FETCH next_ord INTO :Order.OrderId;
CLOSE next_ord;
/*
Make sure we populated a new order id ok...
*/
IF :Order.OrderId IS NULL THEN
Message(’Error Generating Next Order Id’);
RAISE Form_trigger_Failure;
END IF;
/*
Insert a row into the audit table
*/
INSERT INTO ord_audit( orderid, operation, username, timestamp)
VALUES ( :Order.OrderId,’New Order’,USER, SYSDATE );
END;
Follow to get notifications for more tutorials with source code, thanks.


Data entry form example

Pre-insert and Pre-update in Oracle Forms

Reviewed by Rasa on

Mar 24

Rating:
5

Handle tab pages in Oracle forms at runtime with When-Tab-Page-Changed trigger at Form Level. This trigger Fires whenever there is explicit item or mouse navigation from one tab page to another in a tab canvas.

Usage Notes
·  Use a When-Tab-Page-Changed trigger to perform actions when any tab page is changed during
item or mouse navigation.
·  When-Tab-Page-Changed fires only when tab page navigation is explicit; it does not respond to
implicit navigation. For example, the trigger will fire when the mouse or keyboard is used to
navigate between tab pages, but the trigger will not fire if an end user presses [Next Item] (Tab) to
navigate from one field to another field in the same block, but on different tab pages.
·  When-Tab-Page-Changed does not fire when the tab page is changed programmatically.

When-Tab-Page-Changed examples
Use a When-Tab-Page-Changed trigger to dynamically change a tab page’s label from lower- to upper-case (to indicate to end users if they already have navigated to the tab page)

DECLARE
tp_nm VARCHAR2(30);
tp_id TAB_PAGE;
tp_lb VARCHAR2(30);
BEGIN
tp_nm := GET_CANVAS_PROPERTY(’emp_cvs’, topmost_tab_page);
tp_id := FIND_TAB_PAGE(tp_nm);
tp_lb := GET_TAB_PAGE_PROPERTY(tp_id, label);
IF tp_lb LIKE ’Sa%’ THEN
SET_TAB_PAGE_PROPERTY(tp_id, label, ’SALARY’);
ELSIF tp_lb LIKE ’Va%’ THEN
SET_TAB_PAGE_PROPERTY(tp_id, label, ’VACATION’);
ELSE null;
END IF;
END;



Tab Pages In Oracle Forms

Reviewed by Mukund Emmanuale on

Mar 23

Rating:
5

Play_sound is used to play audio files in Oracle Forms, Play_Sound plays the sound object in the specified sound item.

PLAY_SOUND examples
The following plsql block you can write in when-button-pressed trigger for a push button item, when button clicked  read a sound object from the file system and play it. Note: since an item must have focus in order to play a sound, the trigger code includes a call to  the built-in procedure GO_ITEM:

BEGIN
IF :clerks.last_name = ’BARNES’ THEN
GO_ITEM(’orders.filled_by’);
READ_SOUND_FILE(’t:\orders\clerk\barnes.wav’,’wave’,’orders.filled_by’);
PLAY_SOUND(’orders.filled_by’);
END IF;
END;

 

Show_alert is used to display model window messages in Oracle Forms and Find_alert searches the list of valid alerts in Form Builder, when the given alert is located, the subprogram returns an alert ID. You must return the ID to an appropriately typed variable, define the variable with a type of Alert.

Example
Show a user-warning alert. If the user presses the OK button, then make REALLY sure they want to continue with another alert.

See also: Display Modal Window Messages Using Alerts
 http://www.foxinfotech.in/2015/02/using-single-alert-for-messages-and-confirmation-messages.html

[code type="PL/SQL"]Declare
   al_id       alert;
   al_button   NUMBER;
BEGIN
   al_id := FIND_ALERT ('user_warning');

   IF ID_NULL (al_id)
   THEN
      MESSAGE ('user_warning alert does NOT exist');
      RAISE form_trigger_failure;
   ELSE
      /*
      ** Show the warning alert
      */
      al_button := SHOW_ALERT (al_id);

      /*
      If user pressed OK (button 1) then bring up another alert to confirm -- button mappings are specified in the alert design
      */
      IF al_button = alert_button1
      THEN
         al_id := FIND_ALERT ('are_you_sure');

         IF ID_NULL (al_id)
         THEN
            MESSAGE ('the alert NAMED:are you sure ? does NOT exist');
            RAISE form_trigger_failure;
         ELSE
            al_button := SHOW_ALERT (al_id);

            IF al_button = alert_button2
            THEN
               -- do some task
               erase_all_employee_records;
            END IF;
         END IF;
      END IF;
   END IF;
END;[/code]
Follow to get notifications for tutorials with free source code, thanks.


Show_Alert and Find_Alert in Oracle Forms

Reviewed by Mridula Joshi on

Mar 22

Rating:
5

Run_Product is used to run Oracle Reports (RDF/REP files) in Oracle Forms. It invokes one of the supported Oracle tools products and specifies the name of the module or module to be run. If the called product is unavailable at the time of the call, Form Builder returns a message to the end user.
If you create a parameter list and then reference it in the call to RUN_PRODUCT, the form can pass text and data parameters to the called product that represent values for command line parameters, bind or lexical references, and named queries. Parameters of type DATA_PARAMETER are pointers to record groups in Form Builder. You can pass DATA_PARAMETERs to Report Builder and Graphics Builder, but not to Form Builder.

Example:
Call a Report Builder report, passing the data in record group ’EMP_RECS’ to substitute for the report’s query named ’EMP_QUERY’. Presumes the Emp_Recs record group already exists and has the same column/data type structure as the report’s Emp_Query query.

PROCEDURE Run_Emp_Report IS
pl_id ParamList;
BEGIN
/*
** Check to see if the ’tmpdata’ parameter list exists.
*/
pl_id := Get_Parameter_List(’tmpdata’);
/*
** If it does, then delete it before we create it again in
** case it contains parameters that are not useful for our
** purposes here.
*/
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;
/*
** Create the ’tmpdata’ parameter list afresh.
*/
pl_id := Create_Parameter_List(’tmpdata’);
/*
** Add a data parameter to this parameter list that will
** establish the relationship between the named query
** ’EMP_QUERY’ in the report, and the record group named
** ’EMP_RECS’ in the form.
*/
Add_Parameter(pl_id,’EMP_QUERY’,DATA_PARAMETER,’EMP_RECS’);
/*
**Pass a Parameter into PARAMFORM so that a parameter dialog
will not appear
**for the parameters being passing in.
*/
Add_Parameter(pl_id, ’PARAMFORM’, TEXT_PARAMETER, ’NO’);
/*
** Run the report synchronously, passing the parameter list
*/
Run_Product(REPORTS, ’empreport’, SYNCHRONOUS, RUNTIME,
FILESYSTEM, pl_id, NULL);
END;

See also: Running Reports In Oracle Forms 10g



Using Run_Product in Oracle Forms

Reviewed by Avantika on

Mar 22

Rating:
5

The simplest Python application for App Engine is a single directory with two files: a configuration file named app.yaml, and a file of Python code for a request handler. The directory containing the app.yaml file is the application root directory. You’ll refer to this directory often when using the tools.

If you are using the Launcher, you can start a new project by selecting the File menu, New Application.... The Launcher creates a new project with several files, which you may wish to edit to follow along with the
example. Alternatively, you can create the project directory and files by hand, then add the project to the Launcher by selecting the File menu, Add Existing Application....

Create a directory named clock to contain the project. Using your favorite text editor, create a file inside this directory named app.yaml.

The app.yaml configuration file for a simple application

application: clock
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: main.py

This configuration file is in a format called YAML, an open format for configuration files and network  messages. You don’t need to know much about the format beyond what you see here.

In this example, the configuration file tells App Engine that this is version 1 of an application called clock, which uses version 1 of the Python runtime environment (the “API version”). Every request for this application (every URL that matches the regular expression /.*) is to be handled by a Python script named main.py. Create a file named main.py

Example A simple Python request handler script

import datetime
print 'Content-Type: text/html'
print ''
print '<p>The time is: %s</p>' % str(datetime.datetime.now())


When called from an On-Fetch trigger, initiates the default Form Builder processing for fetching records
that have been identified by SELECT processing.

FETCH_RECORDS examples
/*
** Built-in: FETCH_RECORDS
** Example: Perform Form Builder record fetch processing
during
** query time. Decide whether to use this built-in
** or a user exit based on a global flag setup at
** startup by the form, perhaps based on a
** parameter. The block property RECORDS_TO_FETCH
** allows you to know how many records Form Builder
** is expecting.
** trigger: On-Fetch
*/
DECLARE
numrecs NUMBER;
BEGIN
/*
** Check the global flag we set during form startup
*/
IF :Global.Using_Transactional_Triggers = ’TRUE’ THEN
/*
** How many records is the form expecting us to
** fetch?
*/
numrecs := Get_Block_Property(’EMP’,RECORDS_TO_FETCH);
/*
** Call user exit to determine if there are any
** more records to fetch from its cursor. User Exit
** will return failure if there are no more
** records to fetch.
*/
User_Exit(’my_fetch block=EMP remaining_records’);
/*
** If there ARE more records, then loop thru
** and create/populate the proper number of queried
** records. If there are no more records, we drop through
** and do nothing. Form Builder takes this as a signal that
** we are done.
*/
IF Form_Success THEN
/* Create and Populate ’numrecs’ records */
FOR j IN 1..numrecs LOOP
Create_Queried_Record;
/*
** User exit returns false if there are no more
** records left to fetch. We break out of the
** if we’ve hit the last record.
*/
User_Exit(’my_fetch block=EMP get_next_record’);
IF NOT Form_Success THEN
EXIT;
END IF;
END LOOP;
END IF;
/*
** Otherwise, do the right thing.
*/
ELSE
Fetch_Records;
END IF;
END;

The following example finds the commission plan in the COMMPLAN table, based on the current value of the commcode item in the EMPLOYEE block in the form, to verify that the code is valid.
If the code in the COMMPLAN table is located, the description of the COMMPLAN is obtained and deposited in the non-database Description item. Otherwise, an error is raised.

/*
** Method 1: Using a SELECT...INTO statement, the trigger
** looks more readable but can be less efficient
** than Method 2 because for ANSI Standard
** compliance, the SELECT...INTO statement must
** return an error if more than one row is
** retrieved that matches the criteria. This
** implies PL/SQL may attempt to fetch data twice
** from the table in question to insure that there
** aren’t two matching rows.
*/

BEGIN
SELECT description
INTO :Employee.Commplan_Desc
FROM commplan
WHERE commcode = :Employee.Commcode;
EXCEPTION
WHEN No.Data_Found THEN
Message(’Invalid Commission Plan, Use <List> for help’);
RAISE Form_trigger_Failure;
WHEN Too_Many_Rows THEN
Message(’Error. Duplicate entries in COMMPLAN table!’);
RAISE Form_trigger_Failure;
END;

/*
** Method 2: Using an Explicit Cursor looks a bit more
** daunting but is actually quite simple. The
** SELECT statement is declared as a named cursor
** in the DECLARE section and then is OPENed,
** FETCHed, and CLOSEd in the code explicitly
** (hence the name). Here we guarantee that only a
** single FETCH will be performed against the
** database.
*/

DECLARE
noneFound BOOLEAN;
CURSOR cp IS SELECT description
FROM commplan
WHERE commcode = :Employee.Commcode;
BEGIN
OPEN cp;
FETCH cp INTO :Employee.Commplan_Desc;
noneFound := cp%NOTFOUND;
CLOSE cp;
IF noneFound THEN
Message(’Invalid Commission Plan, Use <List> for help’);
RAISE Form_trigger_Failure;
END IF;
END;

Suppose you want to handle an error in oracle forms and want to display custom error message for that error, but also you want to customize more for a particular error. For example there are many fields in form with required property is set to TRUE for Not Null check.

The example below shows the error handling in oracle forms with a specific Frm-40202 error.

On-Error Trigger
Trigger Level - Form

Declare
   error_item varchar2(50);
   curr_item_label varchar2(100);
Begin
   error_item := :system.trigger_item;
   if error_type = 'FRM' and error_code = 40202 then
      curr_item_label := get_item_property(error_item, prompt_text);
     --- you can use alert also to show the message
      message(curr_item_label || ' cannot be left blank.');
   else
      message(error_text);
      --- visual attribute a_errors must exists or create your own
      set_item_property(error_item, current_record_attribute, 'A_errors');
   end if;
end;
Like us to get notifications for free source code in future, thanks.

You want to use the output of a complex query involving aggregates and grouping as source data for
another query.

Oracle allows any query to be used as a subquery or inline view, including those containing aggregates
and grouping functions. This is especially useful where you’d like to specify group-level criteria
compared against data from other tables or queries, and don’t have a ready-made view available.
For our recipe, we’ll use an average salary calculation with rollups across department, job, and start
year, as shown in this SELECT statement.
select * from (
select department_id as "dept", job_id as "job", to_char(hire_date,'YYYY') as
"Start_Year", avg(salary) as "avsal"
from hr.employees
group by rollup (department_id, job_id, to_char(hire_date,'YYYY'))) salcalc
where salcalc.start_year > '1990'
or salcalc.start_year is null
order by 1,2,3,4;


The following output will be generate with the above query:

dept job Start avsal
---------- ---------- ----- ----------
10 AD_ASST 4400
10 4400
20 MK_MAN 1996 13000
20 MK_MAN 13000
20 MK_REP 1997 6000
20 MK_REP 6000

6473.36449
7000
79 rows selected.

In blogger help to set a custom domain name for blogspot there is mention to set A records in Godaddy or other third party domain name provider, but in some cases it seems to be not working.

The problem is when you type your domain name in address bar without www it gives 404 error and not redirecting to your www.yourdomain.com.
Rs. 163 .Coms at GoDaddy!
If you purchased a domain name from Godaddy.com then the solution of this problem is log in to your account in Godaddy.com and follow these steps:

  1. After loging to your account click on My Account button.
  2. In Domain tab click Launch.
  3. Check the checkbox near to your domain and from the above menu choose Forward to domain option.
  4. It will show a window asking to type a domain name with www.yourdomain.com for your naked domain yourdomain.com.
  5. Type in the field provided your full domain name eg. www.yourdomain.com, you can click the preview button to check the forwarding site.
  6. After confirmation click on OK and make sure the Auto DNS Update check box is checked.
Now you are done. It will take around an hour or so to forward naked domain to www.


You have various JPG, PNG, GIF, and BMP image files that need to be managed and backed up in the
database, and you need a way to do an initial load into the database.

Loading binary LOBs is a bit simpler than loading text-based LOBs.

Create a sequence for your image table’s unique identifier, plus the table itself:

create sequence img_seq;

create table image
(
img_num number,
img_nm varchar2(100),
img_blb blob,
ins_ts timestamp
);

Next, run an anonymous block to load the image SCREEN CAPTURE.BMP into your database table:

declare
src_blb bfile; /* point to source BLOB on file system */
dst_blb blob; /* destination BLOB in table */
src_img_nm varchar2(100) := 'Screen Capture.bmp';
src_offset integer := 1; /* where to start in the source BLOB */
dst_offset integer := 1; /* where to start in the target BLOB */
begin
src_blb := bfilename('LOB_SRC',src_img_nm);
insert into image (img_num, img_nm, img_blb, ins_ts)
values(img_seq.nextval, src_img_nm, empty_blob(), systimestamp)
returning img_blb into dst_blb;
dbms_lob.open(src_blb, dbms_lob.lob_readonly);
dbms_lob.loadblobfromfile
(
dest_lob => dst_blb,
src_bfile => src_blb,
amount => dbms_lob.lobmaxsize,
dest_offset => dst_offset,
src_offset => src_offset
);
dbms_lob.close(src_blb);
commit;
dbms_output.put_line('Wrote BLOB to table: ' || src_img_nm);
end;

After running this block, image will be loaded into blob and you can check the record with the following command:

select img_num, img_nm, ins_ts, length(img_blb) from image;


As you may know, Google takes issues regarding program policy compliance very seriously and if your site is not come under Google's policy program you site or account will not get approved by the Google Adsense.

There is a HOPE to get approval, but you have to APPEAL

If your AdSense account has been disabled for violations of  program policies, you may submit an appeal and you can try to explain and ask for apologies to Google Adsense for the reasons your account got disapproved. Click Here To Submit An Appeal

Please note as per Google Adsense you may submit only one appeal for your account. Any additional submissions will not be reviewed.

See also More Blogger Tips

Determining the First Date or Day in a Month In Oracle

You need to dynamically determine the first date in a given month at runtime. Oracle’s TRUNC function can be used on dates to perform start-of-period calculations, such as the first day of the month.

select trunc(sysdate,'mm')
from dual;


TRUNC(SYS
---------
01-MAY-09

Our recipe was written on May 21st. Any arbitrary date, datetime, or timestamp expression can be
used.

Calculating the Day of the Week in Oracle

Determining the day of the week, and also indicate whether it’s considered a work day or weekend.

select to_char(sysdate,'Day') Day_Of_Week,
case
when to_char(sysdate,'D') in (1,7) then 'Weekend'
else 'Weekday'
end Day_Type
from dual;


Running my example on a Monday returns the following results.
DAY_OF_WEEK DAY_TYPE
----------- --------
Monday Weekday

Conversely, running my example on a Saturday shows this output.
DAY_OF_WEEK DAY_TYPE
----------- --------
Saturday Weekend

Converting Strings to Datetime Values in Oracle

You need to convert date information provided in textual form to Oracle’s DATE format. Just as Oracle supports the TO_CHAR function to convert dates and times to text, it supports an equivalent function TO_DATE to perform the complementary process of converting text into dates and times.

select to_date('January 17, 2009', 'Month DD, YYYY') formatted_date
from dual;

FORMATTED_DATE
--------------
17-JAN-09

See also Determining the dates of Easter of any year in Oracle
              Detecting Leap Year In Oracle




Here is the example to determine if any given year is a leap year in Oracle. There are lots of way to get the leap year from any date but some times it becomes complex or typical. The SQL we show next uses the classic definition for leap years.

select to_number(to_char(sysdate,'YYYY')) Year,
case
when mod(to_number(to_char(sysdate,'YYYY')),400) = 0 then 'Leap Year'
when mod(to_number(to_char(sysdate,'YYYY')),100) = 0 then 'Not Leap Year'
when mod(to_number(to_char(sysdate,'YYYY')),4) = 0 then 'Leap Year'
else 'Not Leap Year'
end as "Leap Year?"
from dual;


For the year of 2009, we can see the results are as expected.
YEAR Leap Year?
---- -------------
2009 Not Leap Year

See also Oracle Date Function Examples




Detecting Leap Year In Oracle

Reviewed by Simpson on

Mar 12

Rating:
5

You can change your blogger template with a new template you downloaded recently. The blogger templates comes with .xml extension.

First backup or download your old template to your computer before applying with a new template. To backup old template click -> Template then click the top right button Backup / Restore button, the following window will appear:




Click the download full template to backup old template 

To change a template, you can see in the above image the upload a template section to change a template, you can browse the template and upload it.

Another way to change the template is open your new template in a text editor and copy all the code and then click the Edit HTML button in Template section, the following window will appear:


Select all the code from the window and press delete key then paste the new template code and before saving it click the Preview button to view how the new template looks, if it is fine then click on Save Template button, if it is not fine then click on Clear Edits button and close the window. This is option is much safer.



You want to track when changes occur for a particular table in oracle, but your current table structure hasn’t any dedicated fields for this purpose. You want to determine the date and time of historic changes if possible, and provide a mechanism to track future changes.

Use Oracle’s ORA_ROWSCN pseudo-column and the SCN_TO_TIMESTAMP function to find approximate or exact times that rows were changed.

The next SQL illustrates the SCN_TO_TIMESTAMP function using the ORA_ROWSCN pseudo-column to determine the TIMESTAMP value at which rows in the Hr.employees table were changed.

select employee_id, last_name, salary,
scn_to_timestamp(ora_rowscn) Change_Timestamp
from hr.employees;


EMPLOYEE_ID LAST_NAME SALARY CHANGE_TIMESTAMP
----------- --------- ------ -------------------------------
210 King 3510 12-SEP-09 03.54.55.000000000 PM
211 Sully 3510 12-SEP-09 03.54.55.000000000 PM
212 McEwen 3510 12-SEP-09 03.54.55.000000000 PM
100 King 24000 08-AUG-09 11.06.28.000000000 PM
101 Kochhar 17000 08-AUG-09 11.06.28.000000000 PM
102 De Haan 17000 08-AUG-09 11.06.28.000000000 PM


You want to connect multiple databases in oracle forms to perform certain tasks, for example you need to execute ddl or dml statements against databases but when you try to use dblink it gives you error or suddenly quits from the oracle forms.

Solution - 1


You can create Database Synonyms for the objects which you want to access through dblink in oracle forms. Suppose you want to execute a procedure from another database, create a synonym for that procedure in current database and access it in oracle forms.

Solution - 2

Use Exec_Sql package in oracle forms to access multiple database and to execute any ddl and dml statements. A simple example is given below:

declare
    cid exec_sql.conntype;
    cursorid exec_sql.curstype;
begin
    cid := exec_sql.open_connection('scott/tiger@db3');
     cursorid := exec_sql.open_cursor(cid);
     exec_sql.parse(cid, cursorid, 'drop table emp2 ', exec_sql.v7);
     exec_sql.close_cursor(cid, cursorid);
     exec_sql.close_connection(cid);
end;


The update statement is used to update as many rows as you need in one statement. This means
you can use multiple column = value clauses in the UPDATE statement to change as many fields as you
wish in one statement. The syntax of an Update statement is:

Update table_name
    set column = value [, column = value]
[where <restrictive-condition>]

For example, to change the phone number, job role, and salary of John Marlow,
EMPLOYEE_ID 129, we can use a single UPDATE statement.

update hr.employees
set job_id = 'ST_MAN',
phone_number = '650.124.9876',
salary = salary * 1.5
where employee_id = 129;

See also: Oracle Insert Statement Examples



Update Statement Examples

Reviewed by J. Mathew on

Mar 18

Rating:
4.5

Example is given below for insert into statement of Oracle. To be able to insert rows into a table, you must either own the table in your schema or you must have insert privilege on the table. The format for a typical insert would be:

Insert into <table-expression> <column-list>
     values (<values>)

Example
Insert into scott.emp (empno, ename, sal)
   values (100, 'John', 589.90);

You can also use Select statement to populate one table from another table.

Example
insert into hr.employees
(employee_id, first_name, last_name, email, phone_number, hire_date, job_id, salary,
commission_pct, manager_id, department_id)
select 210, first_name, last_name, email, phone_number, sysdate, 'IT_PROG', 3500,
NULL, 103, 60
from hr.candidates
where first_name = 'Susan'
and last_name = 'Jones';

You can also insert into multiple tables with a single insert statement.

Example
Insert First
   when comm >= 1000 then
     into high_comm
   when comm < 1000 then
     into other_comm
   else
     into no_comm
 Select empno, ename, comm
  from emp;

See also: Oracle Update Statement Examples



Insert Statement Examples

Reviewed by Marian Simpson on

Mar 14

Rating:
4

Highlight a Text Item in Oracle Forms With Visual Attribute

It is very necessary to highlight the current cursor text item in data entry forms so that a user can easily notice the current item.

Steps to highlight current item

1.   Create a visual attribute and set the background color (as per your choice) property as shown below:

2.   Then write a When-New-Item-Instance trigger to specify the current visual attribute to an item, with the following code.

When-New-Item-Instance Trigger Code:
-- first get if item type is text item
Begin
IF GET_ITEM_PROPERTY(:SYSTEM.CURSOR_ITEM, ITEM_TYPE) = 'TEXT ITEM' THEN
-- you can take current item into global variable, it will help you in next trigger
    :GLOBAL.CRITEM := :SYSTEM.CURSOR_ITEM;

-- specify the attribute you just created

    SET_ITEM_PROPERTY(:SYSTEM.CURSOR_ITEM, CURRENT_RECORD_ATTRIBUTE, 'RECATB');
-- high light the current item
END IF;
End;
3.   Then write Post-Text-Item trigger to restore the default color of a text item.

Post-Text-Item Trigger Code:

Begin
  IF :GLOBAL.CRITEM IS NOT NULL THEN
    -- you can specify your normal color attribute here
    SET_ITEM_PROPERTY(:GLOBAL.CRITEM, CURRENT_RECORD_ATTRIBUTE, 'Default');
  END IF; 
End;
Now you can check the result by running your form.

Highlight current item example data entry form in oracle.

You are blogging from long time and having good visitors to your blog and making good money also but your domain name is something like http://yourblog.blogspot.com which you may be don't like some times. So don't worry you can have your independent domain name for your blog in INR 199 per year ($3.5 p.a.).
30% off your entire order at GoDaddy.com!
Charge For Domain Name
You have to pay the charge for domain name only which is around $4 USD per year, you don't have to pay for hosting charge because hosting will be through Google which is free.

How to buy a domain name ?
Buying domain name is easy, you can check this link Buying Domain Name For Blogger

It is feeling like you have a site on net in just $10.

Set Icon_File property in When-Mouse-Enter trigger

Suppose you are creating icon based menu system in Oracle Forms 6i and you want to change icon when mouse over on any push button.

You can accomplish this task by writing form level trigger when-mouse-enter and when-mouse-leave, here is the example:

Create a block, design accordingly and place push buttons as per the requirement and set iconic property to yes and specify default icon file.

Then write when-mouse-enter trigger Form Level, this trigger will fire when-ever mouse enter over on any item.
Declare
  vMousetime varchar2(100) := lower(:system.mouse_item);
Begin
-- check for your button and specify the new icon
   if vMouseitem = 'yourblock.urbutton1' then
     set_item_property(vmouseitem, icon_file, 'onhover1');
   elsif vmouseitem = 'yourblock.urbutton2' then
     set_item_property(vmouseitem, icon_file, 'onhover2');
-- and so on for your all buttons
   end if;
End;

Write when-mouse-leave trigger Form Level, this trigger will fire when-ever mouse leave any item.

Declare
  vMousetime varchar2(100) := lower(:system.mouse_item);
Begin
-- check for your button and restore the default icon
   if vMouseitem = 'yourblock.urbutton1' then
     set_item_property(vmouseitem, icon_file, 'default1');
   elsif vmouseitem = 'yourblock.urbutton2' then
     set_item_property(vmouseitem, icon_file, 'default2');
-- and so on for your all buttons
   end if;
End;

Now you can test your menu.


Center window automatically  in Oracle Forms 6i, use the following procedure by passing window name as parameter:

Example

PROCEDURE auto_centre (pwn in varchar2) IS
vw number := get_window_property(forms_mdi_window, width);
vh number := get_window_property(forms_mdi_window, height);
BEGIN
set_window_property(pwn, x_pos, (vw - get_window_property(pwn, width)) / 2);
set_window_property(pwn, y_pos, (vh - get_window_property(pwn, height)) / 2);
END;



More Topics

V. Kapoor

{picture#https://3.bp.blogspot.com/-q3wCssWUHo8/ViDFfCpPEuI/AAAAAAAAD0M/MHPvgnl3T3U/s1600/authpic.JPG} Vinish Kapoor is a Software Consultant, currently working in a reputed IT company in Noida, India and doing blogging on Oracle Forms, SQL and PLSQL topics. He is an author of an eBook Oracle Forms Recipes, which is available on Google play. {facebook#https://www.facebook.com/foxinfotech2014} {twitter#https://twitter.com/foxinfotech} {google#https://plus.google.com/u/0/+VKapoor/posts}
Fox Infotech. Powered by Blogger.