> For the complete documentation index, see [llms.txt](https://docs.layraweb.com.tr/merhaba/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layraweb.com.tr/merhaba/sql-tarafi/konular/prosedur/prosedur-nasil-yazilir.md).

# Prosedür Nasıl Yazılır

SQL prosedürleri, veritabanı işlemlerini yapmak için kullanabileceğiniz bir komutlar kümesidir. Prosedürler veritabanı içinde depolanır ve istenildiğinde tekrar kullanılabilir. Prosedür yazmak için aşağıdaki adımları takip edebilirsiniz:

1. Veritabanınıza bağlanın: Veritabanı yöneticisi veya SQL komut satırı aracı kullanarak veritabanınıza bağlanın.
2. CREATE PROCEDURE komutunu kullanın: CREATE PROCEDURE ifadesi ile bir prosedür tanımlayın.
3. Prosedür adı ve parametrelerini tanımlayın: Prosedür adını belirtin ve gerekirse girdi parametrelerini tanımlayın.
4. Prosedür içeriğini tanımlayın: BEGIN ve END ifadeleri arasında prosedürün ne yapacağını tanımlayın. İşlemler SQL komutları olarak yazılabilir.
5. Prosedürü kaydedin: Tüm prosedür tanımlamaları tamamlandıktan sonra, prosedürü kaydedin.

Örnek prosedür:

```sql
CREATE PROCEDURE GetCustomerOrders (@customerID INT)
AS
BEGIN
   SELECT OrderID, OrderDate, CustomerID
   FROM Orders
   WHERE CustomerID = @customerID
END
```

Bu prosedür, veritabanındaki "Orders" tablosundaki müşterinin sipariş bilgilerini sorgular ve sonuçları gösterir. Prosedür, müşteri ID'sini alan bir parametre alır.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.layraweb.com.tr/merhaba/sql-tarafi/konular/prosedur/prosedur-nasil-yazilir.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
