Skip to Content
author's profile photo Former Member
Former Member

how to go through table cells

Hi experts,

In a given table in hana, is it possible to go though cells. My current progress is hampered by the need to specify column names. For example,

SELECT <column name> FROM <table name>;

DECLARE i INT;

DECLARE j INT;

SELECT COUNT(*) INTO j FROM <table name>;

FOR i in 1..j DO

if <table name>. <column name>[i] > 0.05

then .........

END FOR;

But I want to go through all the cells regardless of the columns. Is it possible in hana with static sql?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Aug 23, 2016 at 10:39 AM

    Hello

    What is your requirement? I'm sure there will be a more elegant solution than iterating over all rows and columns.

    Michael

    Add a comment
    10|10000 characters needed characters exceeded

    • I wouldn't say that their use is inevitable.

      When writing applications to consume HANA data, push as much logic into the database as possible, and then consume the smallest result set in the consumption layer - and here is where you might find programming features to iterate over rows and columns.

      Michael

  • Posted on Aug 23, 2016 at 01:08 PM

    Yes, it is possible with Static SQL

    use this Query:

    Select

    Case

    when clolumn1 > 0.05

    then ...

    else

    end as column1,

    Case

    when clolumn2 > 0.05

    then ...

    else

    end as column2,

    .....

    ....

    ....

    <like wise for all columns>

    From Table.

    Happy HANA 😊

    Gopinath.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.