Home > database >  How to use a table in PB fields to update another table fields
How to use a table in PB fields to update another table fields

Time:10-10

I built the two tables, respectively is The Times table and movie tickets table, tickets to the theatre. There are 80 data column corresponding to a film session, I now want to the name of the same film screenings and ticket price synchronization to the 80 series, how to implement

CodePudding user response:

Execute SQL statements, or transaction, with data window

CodePudding user response:

80 data column is the ticket? The number of updates to the ticket? With the update statement? Still think too many fields, using dynamic SQL to perform?

CodePudding user response:

I mean yes session list film and fare, then 80 tickets for a game, is the eighty data, how can a shadow to update all the tickets, I used the update not line

CodePudding user response:

reference 1st floor r00_a2lBUR response:
execute SQL statements, or transaction, use the data window

I mean yes session list film and fare, then 80 tickets for a game, is the eighty data, how can a shadow to update all the tickets, I used the update not line

CodePudding user response:

refer to the second floor qq_33259475 response:
have 80 data column is the ticket? The number of updates to the ticket? With the update statement? Still think too many fields, using dynamic SQL to perform?

I mean yes session list film and fare, then 80 tickets for a game, is the eighty data, how can a shadow to update all the tickets, I used the update not line

CodePudding user response:

Write a stored procedure ~

CodePudding user response:

Table structure said

CodePudding user response:

Update the ticket t1
Set (t1), a t1. B)=(
Select t2. J a, t2. B from t2 time where t1. The session ID=t2. The session ID
)
Where a t1. XXXX...

CodePudding user response:

1, write a stored procedure, with input and output parameters
2, write stored in the transaction object used in the PB process definition
3, call a stored procedure in the code, if use the transaction object is the SQLCA
The sqlca. The autocommit=true
The sqlca. Stored procedure name (parameters parameters 1, 2, 3... )
The sqlca. The autocommit=false
If the sqlca. Sqlcode=0 then
Commit the using the sqlca;
The else
String ls_sqlerrtext
Ls_sqlerrtext=sqlca. Sqlerrtext
The rollback using sqlca;
Messagebox (' prompt ', 'execution error, error reason: + ls_sqlerrtext)
end if

CodePudding user response:

How do you spell your update, what is the table structure

CodePudding user response:

Not table structure, said the pure technology, realize there is a wide variety of way,
Update the ticket table
Set tickets. Data column 1=session table. Prices,
Price tickets. Data column 2=session table.,
.
The from session table
Where the ticket table. The movie name=session table, film name and the ticket table.
session=session table, game

Of course, really wanted to be lazy, dynamic statement to also go,

If it is fixed 80 columns, my habit is to write to death, ha, ha, ha,

CodePudding user response:

Update the target table set column=value
From the target table, the other table where conditions

Give you an example:
The update d_order_detail set d_order_detail. Res_capacity=business_channel. Bc_capacity
The from dispatch_order
, d_order_detail
, business_channel
Where business_channel. Dispatch_order_id=dispatch_order. Dispatch_order_id
And d_order_detail. Order_detail_id=dispatch_order. Order_detail_id
='FRK and business_channel. Bc_code/CT - Moscow/CT v4c001 * 16 IP'

CodePudding user response:

This is a typical application triggers, add a trigger events form, to increase the deletion session table by near-end type, near-end seats and so on data, operating on the ticket form,
  • Related