Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can anyone rewrite the red part into pure SQL format.( stored procedures) //System.out.printin(address arrt1]) PreparedStatement insert Address connection.prepareStatement(.. + INSERT INTO , address? +VALUES (NULL,

Can anyone rewrite the red part into pure SQL format.( stored procedures) image text in transcribed
image text in transcribed
image text in transcribed
//System.out.printin(address arrt1]) PreparedStatement insert Address connection.prepareStatement(.. + "INSERT INTO , address? +"VALUES (NULL, ?,?,?,?,? insertAddress.setString(1, address arr]); insertAddress.setString(2, address arr1]); insertAddress.setString(3, address arr[2]); insertAddress.setstring(4, address arr[3]); insertAddress.setInt(5, Integer.parseInt (address arr[4])) insertAddress.execute) PreparedStatement insertPatient connection.prepareStatement(" +"INSERT INTO patient' "VALUES (NULL,,?,?,LAST INSERT ID) insertPatient.setstring(1, p.getFirstName)); insertPatient.setString(2, p.getLastName)); insertPatient.setString(3, p.getPhoneNumber)) insertPatient.executeO; PreparedStatement insertPaymentMethod connection "prepareStatement(.. //+ SELECT id INTO @id from 'payment-method. WHERE ,description. = ? LMIT 1;. +"INSERT INTO payment method VALUES" +(NULL,) insertPaymentMethod.setstring(1, p.getPaymentMethod)); insertPaymentMethod.execute); SimpleDateFormat dateFormat- new SimpleDateFormat( "MMddyyyy java.util.Date date dateFormat.parse(p.getDateOfFilled)) Date sq1Date new Date(date.getTime)) PreparedStatement insertPrescription = connection.prepareStatement(.. +INSERT INTO prescription + "VALUES (NULL, (SELECT MAX(id) FROM 'patient'), ? ?, LAST-?NSERT-?D()); . insertPrescription.setInt(1, p.getPrescriberId)); insertPrescription.setDate(2, sqlDate); insertPrescription.execute) PreparedStatement insertConpanyName connection. prepa restatement("" +"INSERT INTO drug company +"VALUES (NULL, ?, ) insertCompanyName.setString(1, p.getDrugCompanyO) insertCompanyName.execute) PreparedStatement insertDrug connection.prepareStatement( +"INSERT INTO drug + "VALUES (NULL, ?,?,?,?,?, LAST-INSERT-ID());"); insertDrug.setString(1, p.getDrugNameO); insertDrug.setDouble(2, p.getDrugCostO); insertDrug.setDouble(3, p.getAmount)); insertDrug.setInt (4, p.getUnitO); insertDrug.setInt (5, p.getDose)); insertDrug.execute); PreparedStatement insertPrescriptionItems connection.prepareStatement( +"INSERT INTO prescription itens + "VALUES ( (SELECT MAX(id) FROM 'prescription.), LAST-INSERT-ID()); "); insertPrescriptionItems.executeO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

What is the type of an F# heap-allocated mutable variable?

Answered: 1 week ago

Question

Data Table Requirements Dom Data Table Requirements Dom

Answered: 1 week ago

Question

8. Managers are not trained to be innovation leaders.

Answered: 1 week ago