Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar
Contributor

Here is a simple example

--Running a Select count inside Beeline for a table by name patb

0: jdbc:hive2://node1:10000> select * from patb;

| patb.ida | patb.name | patb.month |

| 5 | Ujjain | 6 |

1 row selected (0.388 seconds)

Now we go ahead and set a variable.

0: jdbc:hive2://node1:10000> set hivevar:tablename=patb;

No rows affected (0.005 seconds)

0: jdbc:hive2://node1:10000> select * from ${hivevar:tablename};

| patb.ida | patb.name | patb.month |

| 5 | Ujjain | 6 |

1 row selected (0.14 seconds)

Resolution: Please set the variable as set hivevar:tablename=patb;

2,531 Views