sudhakar1k has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

When I used this § Symbol directly am not getting any value from the DB. Whereas when i run the same query in the SQL Dev. am able to get the records. Is't any way to fetch the records using the perl program? Kindly let me know your thoughts.

Now am changing the perl version and db version to the latest one.

Thanks in advance.

Sudhakar

  • Comment on When using § symbol am not getting any value

Replies are listed 'Best First'.
Re: When using § symbol am not getting any value
by tobyink (Canon) on Apr 24, 2012 at 09:21 UTC

    Investigate what character encoding the database expects to be sent (probably utf-8), and what character encoding you're using.

    In particular, make sure your files are saved in UTF-8, and contain the following line near the top:

    use utf8;
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

      This is query am trying to execute, having problem with this § symbol. If this symbol is not present am getting the values correctly. But when I used this symbol records not getting correctly. I suppose not to ignore the symbol in this query.

      SELECT DISTINCT a.area_code, t.trans_text AS Area_Name, a.area_sakey, +a.sort_order_num AS Area_Sort_Num FROM BL_trans t, pmon_cfg_fac pcf, +BL_station s, BL_equip e, BL_department d, BL_area a, BL_plant p, pmo +n_cfg_fac_type pcft , bl_gen_row_col_value grcv WHERE a.area_sakey = +d.area_sakey AND d.department_sakey = e.department_sakey AND e.equip_ +sakey = s.equip_sakey AND s.station_sakey = pcf.station_sakey AND a.a +rea_name_text_sakey = t.text_sakey AND a.plant_sakey = p.plant_sakey +AND p.plant_code = 'DAGEE' AND t.lang_code || NULL = '0X0409' AND pcf +.facility_type_id = pcft.facility_type_id AND s.station_sakey=grcv.ge +n_row_sakey AND grcv.gen_table_code='BL_STATION' AND grcv.appl_code=' +PMON' AND grcv.appl_col_code='SUPPLIER_ACCESS_LIST' AND (grcv.text_va +lue like '%B43P §%' or grcv.text_value like '%CXM7A§%' or grcv.text_v +alue like '%P73KA§%') AND pcft.qas_flag <> 'Y' ORDER BY a.sort_order_ +num, a.area_code

        The "§" sign can be encoded as different byte values depending on the encoding the component uses ("code page" is another term you might be familiar with).

        You have to find out (and make the same) all the different places where the encoding matters:

        • Find out what encoding your database driver uses.
        • Find out what encoding the database column values are in.
        • Find out what encoding your SQL string in your Perl script uses.
        • Find out what encoding your console uses to display strings. You can eliminiate that by replacing all bytes above \x7f with hexdumps in the output from your Perl script.
        • Find out what encoding your HTML page declares. You can eliminiate that if you are not outputting HTML.
        • Find out what encoding your HTML page is written in. You can eliminiate that if you are not outputting HTML.
        • Find out what encoding your browser thinks the HTML page is in. You can eliminiate that if you are not outputting HTML.

        My suggestion is to pull all places to input and output Unicde encoded as UTF-8, but that is not always possible. But at least declare in your ETL scripts and every place that reads or writes data what encoding is expected on input and what encoding is created on output.

Re: When using § symbol am not getting any value
by marto (Cardinal) on Apr 24, 2012 at 08:41 UTC

    "Is't any way to fetch the records using the perl program? Kindly let me know your thoughts."

    Using which Perl program? If it's something you've written if you post a short example script which demonstrates the problem.

    Also, you've posted in the wrong section of the site. See Where should I post X?.

Re: When using § symbol am not getting any value
by JavaFan (Canon) on Apr 24, 2012 at 09:03 UTC
    When I used this § Symbol directly am not getting any value from the DB
    Well, yeah, I'm not surprised. § is not a valid SQL command in any dialect I know off.

    What is it what you did, and what result did you expect to get?