Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Same query but different results, why?

873970Jan 26 2017 — edited Jan 27 2017

Hi, i want automatically calculate max length of tables column data.When i type column name manually in max(length(column_name)) function result is correct,  But when i give column name with parameter result is wrong.

How must i give column name with parameter to get correct result.

Thans

--query which result is correct

SELECT MAX(LENGTH (INFO)) FROM system.help;

--wrong result

DECLARE

v_col_name varchar2(100):='INFO';

v_result varchar2(100);

begin

SELECT MAX(LENGTH (v_col_name)) into v_result FROM system.help;

dbms_output.put_line(v_result);

end;

This post has been answered by Bharat G on Jan 26 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 24 2017
Added on Jan 26 2017
16 comments
1,076 views