0
I intend to generate a view through php to an oracle database where select is done through the result of another query.
This query mounts select to view:
$sql1 = "SELECT TESTE FROM VIEW_TESTE";
$result1 = odbc_exec($conOraSql , $sql1);
while ($row1 = odbc_fetch_array($result1)) {
$arrData[] = $row1["TESTE"]."<br />";
}
$select = implode('',$arrData);
The outcome of this consultation:
SELECT 'VAL1' COL1, 'VAL2' COL2, 'VAL3' COL3, 'VAL4' COL4, 'VAL5' COL5, 'VAL6' COL6, 'VAL7' COL7, 'VAL8' COL8 FROM VIEW TABELA1
UNION ALL
SELECT 'VAL1' COL1, 'VAL2' COL2, 'VAL3' COL3, 'VAL4' COL4, 'VAL5' COL5, 'VAL6' COL6, 'VAL7' COL7, 'VAL8' COL8 FROM VIEW TABELA2
UNION ALL
SELECT 'VAL1' COL1, 'VAL2' COL2, 'VAL3' COL3, 'VAL4' COL4, 'VAL5' COL5, 'VAL6' COL6, 'VAL7' COL7, 'VAL8' COL8 FROM VIEW TABELA3
And with this result, I wanted to set up a view this way, but without success, some hint?
$sql2 = "CREATE OR REPLACE FORCE VIEW \"USUARIO\".\"VIEW_TESTE2\" (\"COL1\", \"COL2\", \"COL3\", \"COL4\", \"COL5\", \"COL6\", \"COL7\", \"COL8\") AS $select";
$result2 = odbc_exec($conOraSql , $sql2);