Implementing Barcode and QR Code

 

Implementing Barcode and QR Code in Oracle APEX

Oracle APEX allows developers to extend standard reports and cards with visual machine-readable elements such as Barcodes and QR Codes. These elements are extremely useful in applications involving inventory management, asset tracking, product catalogs, and logistics systems.

This blog explains how to generate Barcodes using SVG and QR Codes using HTML placeholders directly from SQL queries in Oracle APEX.

Barcode Generation in Oracle APEX

Barcodes can be rendered using SVG and JsBarcode attributes directly from a SQL query. This method allows dynamic barcode creation based on database values.


Barcode SQL Query

SELECT id, name, barcode, '<svg class="barcode" jsbarcode-format="CODE39" jsbarcode-value="' || barcode || '" jsbarcode-text="' || barcode || ', ' || name || ', ' || id || '" jsbarcode-textmargin="5" jsbarcode-linecolor="blue" jsbarcode-background="transparent"> </svg>' AS barcode_svg FROM barcode_k;

Explanation

  • CODE39 is a widely supported barcode format.

  • jsbarcode-value dynamically encodes the barcode number.

  • jsbarcode-text displays readable details below the barcode.

  • SVG ensures high-quality, scalable output across devices.

  • The barcode renders dynamically for each record.

-----------------------------------------------------------------------------------------------------------------------------

QR Code Generation in Oracle APEX

QR Codes are ideal for storing URLs, product details, or asset references. In APEX, QR codes can be generated using HTML placeholders and populated dynamically from database values.



QR Code SQL Query

SELECT name, barcode, '<div class="qr-code" data-value="' || APEX_ESCAPE.HTML_ATTRIBUTE(website_url) || '"></div>' AS qr_code_html FROM barcode_k;

Explanation :

  • data-value holds the dynamic QR content (URL or text).

  • APEX_ESCAPE.HTML_ATTRIBUTE ensures secure HTML rendering.

  • The QR code is generated on the client side using JavaScript

  • Prevents XSS and ensures safe attribute handling.


Conclusion

By combining SQL, HTML, and client-side rendering, Oracle APEX enables seamless integration of

Barcodes and QR Codes into reports and cards. This approach enhances usability, supports automation,

and modernizes enterprise applications with minimal effort. Whether used for tracking, identification,

or navigation, barcode and QR code integration adds significant value to any APEX application.

Comments

Popular posts from this blog

Converting your Spreadsheet into a Cloud App using Oracle APEX

Building a Wizard-Based Application in Oracle APEX

Payment Gateway in Oracle APEX using Razorpay