Advertisement
abrar1

Untitled

Dec 11th, 2020 (edited)
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. ##ekhan theke
  2.  
  3.             cursor = connection.cursor()
  4.             days = ['SATURDAY', 'SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY']
  5.             start = '9:00'
  6.             end = '17:00'
  7.             for day in days:
  8.                 sql = "INSERT INTO ROSTER(EMPLOYEE_ID, WEEKLY_DAY,START_TIME, END_TIME) values(%s, %s, %s, %s) ;"
  9.                 cursor = connection.cursor()
  10.                 cursor.execute(sql, [max_id, day, start, end])
  11.                 connection.commit()
  12.                 cursor.close()
  13.  
  14.             sql = "select b.WEEKLY_OFFDAY from BRANCH b, BRANCH_EMPLOYEE be where b.BRANCH_ID = be.BRANCH_ID and be.EMPLOYEE_ID = %s;"
  15.             cursor = connection.cursor()
  16.             cursor.execute(sql, [max_id])
  17.             result = cursor.fetchall()
  18.             cursor.close()
  19.  
  20.             off_day = result[0][0]
  21.  
  22.             sql = "update ROSTER set START_TIME = %s, END_TIME = %s where EMPLOYEE_ID = %s and WEEKLY_DAY = %s;"
  23.             cursor = connection.cursor()
  24.             cursor.execute(sql, ['Off-day', 'Off-day', max_id, off_day])
  25.             connection.commit()
  26.             cursor.close()
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement