user6447827 user6447827 - 26 days ago 8
SQL Question

Unable to execute command [create sequence hibernate_sequence start with 1 increment by 1]

I am getting unsufficient privilages error while generating sequence.

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "eventId_seq")
@SequenceGenerator(name = "eventId_seq", sequenceName = "Event_seq",allocationSize = 1)
private int eventId ;


and i have tried following commands using sys and XYZ user.

grant usage on sequence XYZ.eventId_seq to XYZ


it is giving me 'missing or invalid privilege' error.

Please help.
Thanks

Answer

If sequence is in XYZ schema you don't need any grant to use it. But you may need grant to create sequence to user utilised to connect database (I guess it is XYZ):

grant create sequence to XYZ;