Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##ekhan theke
- cursor = connection.cursor()
- days = ['SATURDAY', 'SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY']
- start = '9:00'
- end = '17:00'
- for day in days:
- sql = "INSERT INTO ROSTER(EMPLOYEE_ID, WEEKLY_DAY,START_TIME, END_TIME) values(%s, %s, %s, %s) ;"
- cursor = connection.cursor()
- cursor.execute(sql, [max_id, day, start, end])
- connection.commit()
- cursor.close()
- sql = "select b.WEEKLY_OFFDAY from BRANCH b, BRANCH_EMPLOYEE be where b.BRANCH_ID = be.BRANCH_ID and be.EMPLOYEE_ID = %s;"
- cursor = connection.cursor()
- cursor.execute(sql, [max_id])
- result = cursor.fetchall()
- cursor.close()
- off_day = result[0][0]
- sql = "update ROSTER set START_TIME = %s, END_TIME = %s where EMPLOYEE_ID = %s and WEEKLY_DAY = %s;"
- cursor = connection.cursor()
- cursor.execute(sql, ['Off-day', 'Off-day', max_id, off_day])
- connection.commit()
- cursor.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement