> For the complete documentation index, see [llms.txt](https://simon-6.gitbook.io/simoncyber/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simon-6.gitbook.io/simoncyber/portswigger-web-academy/sql-injection/lab-10.md).

# Lab 10

You can use the `CAST()` function to achieve this. It enables you to convert one data type to another. For example, imagine a query containing the following statement:

`CAST((SELECT example_column FROM example_table) AS int)`

Often, the data that you're trying to read is a string. Attempting to convert this to an incompatible data type, such as an `int`, may cause an error similar to the following:

`ERROR: invalid input syntax for type integer: "Example data"`

{% hint style="info" %}
Sometimes causing errors will allow you to see the query it uses
{% endhint %}

<figure><img src="/files/p85ANdnhrBJeoalS7Yy8" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/DNoR5cl8gEiq3nY2a1S8" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Peo41I9yFoEnwSNERwwX" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/hG6WbEcBhFoBKIS05rlb" alt=""><figcaption></figcaption></figure>
