The Code of Hammurabi is often cited as the oldest written laws on record, but they were predated by at least two other ancient codes of conduct from the Middle East. The earliest, created by the Sumerian ruler Ur-Nammu of the city of Ur, dates all the way back to the 21st century B.C., and evidence also shows that the Sumerian Code of Lipit-Ishtar of Isin was drawn up nearly two centuries before Hammurabi came to power.
Hope this helped!!!