Two Table in 1 p4 code

What I need to know is, how to use two tables in 1 p4 code.

In my problem, packets come to the first table then we do some processing there and create a variable.
After this packets go to the second table and rest of the processing happen there.

I have the following doubts.
1)How to make two tables in 1 p4 code(can I simply declare them as we do with 1 table?).
2)The variable I created in processing with table 1 how to pass this variable to the action of another table.
3) How to pass the same packet to another table.

Please reply as soon as possible, its quite urgent in my project.

Yes, you can declare 2 (or more) tables in your P4 program, and this is extremely common. A P4 program with only 1 table is very limited in what it can do.

Typically a P4 action has access to all of the local variables and control variables in its “scope”, i.e. declared earlier within the same enclosing “control” body. You do not need to pass such local variables as parameters to the action – they are visible in a way similar to accessing global variables in C or other programming languages.

In this example P4 program, you can see two tables being applied inside of the control ingressImpl: p4-guide/demo1-heavily-commented.p4_16.p4 at master · jafingerhut/p4-guide · GitHub

The variable ‘l2ptr’ is assigned by some actions of the first table, and used as a key for the second table.