0

I have a longshot question. We are using the printer listed above and are trying to get Code 39 barcodes to print from it. I have looked at the following documentation https://files.support.epson.com/pdf/general/escp2ref.pdf specifically the top of page 327. I followed that snippet to a tee in my code and had no luck. I am working with PLSQL and wanted to know if anyone had any luck or tips. The p_string comes in as such xxxxxxxx-xxxxx . The x = numbers 0-9. My latest attempt was cutting out the BC DATA variable and just passing in the p_string which would be our desired output anyway.

FUNCTION get_barcode_epson (p_string IN VARCHAR2) RETURN VARCHAR2 IS
--
  v_print_string       VARCHAR2 (1000);
  escp_bc              VARCHAR2 (20);

  BC_COMMAND   CONSTANT VARCHAR2 (14) := CHR(27)||CHR(40)||CHR(66)||CHR(13)||CHR(0);                       --Barcode command and data length
  BC_TYPE      CONSTANT VARCHAR2 (2)  := CHR(5);                                                           --Barcode type k = Code 39
  BC_WIDTH     CONSTANT VARCHAR2 (2)  := CHR(2);                                                           --Module width m = 2 dots/180 inch
  BC_SPACE     CONSTANT VARCHAR2 (2)  := CHR(0);                                                           --Space adjustments value s = +o dots / 360 inch
  BC_LENGTH    CONSTANT VARCHAR2 (5)  := CHR(125)||CHR(0);                                                 --Bar length v1, v2 = 125 /180 inch
  BC_CTRL_FLG  CONSTANT VARCHAR2 (2)  := CHR(3);                                                           --Control Flags c
--  BC_DATA      CONSTANT VARCHAR2 (20) := CHR(49)||CHR(50)||CHR(65)||CHR(66)||CHR(36)||CHR(37)||CHR(46);                       --Barcode data


  --
  DATA_LENGTH CONSTANT NUMBER := LENGTH (p_string);
--
BEGIN
--
  IF (DATA_LENGTH > 255) THEN RETURN 'TOO LONG'; END IF;
  escp_bc  := BC_COMMAND   ||
              BC_TYPE      ||
              BC_WIDTH     ||
              BC_SPACE     ||
              BC_LENGTH    ||
              BC_CTRL_FLG;  --||
              --BC_DATA;*/
  --
  v_print_string := escp_bc || p_string;
  RETURN v_print_string;
--
END get_barcode_epson;
  • Your code may be either a standalone function or a package function. Since you do not mention a package and the indentation (of lack thereof) leads me to conclude it is a standalone function. However the declaration is missing necessary command "create or replace " Once correcting for that the function compiled. – Belayer May 05 '21 at 17:28
  • It is contained within a package. I posted it was in a function to show the parameter being passed in. – james_weasel May 07 '21 at 14:41

0 Answers0