I have a stored procedure that is failing. The current query behind it is:
SELECT DISTINCT
<many, many values>
FROM
table1
LEFT OUTER JOIN table2 ON
(table2.key =
(select max (table2.key) from table2
where table2.key = table1.key) or
... (0 Replies)
example sql:
select a.a1,b.b1,c.c1,d.d1,e.e1
from a
left outer join b on a.x=b.x
left outer join c on b.y=c.y
left outer join d on d.z=a.z
inner join a.t=e.t
I know how single outer or inner join works in sql.
But I don't really understand when there are multiple of them.
can... (0 Replies)
Hi I'm looking to query a table on a database and then iterate over the results in a loop. I believe this is the last part of my script that I need (after finding out threads for passing variables to other scripts and calling functions in other scripts). I've searched the forums but the best... (8 Replies)
Hi -- I have the following SQL query in my UNIX shell script -- but the subquery in the second section is very slow. I know there must be a way to do this with a union or something which would be better. Can anyone offer an alternative to this query? Thanks.
select
count(*)
from
... (2 Replies)
Am having a nightmare with a certain piece of code.. have tried almost everything and just cannot see what the issue is..
CREATE OR REPLACE VIEW TOP_EARNER_PER_LOCATION
AS
SELECT E.FIRST_NAME || ' ' || E.LAST_NAME AS EMPLOYEE_NAME,
L.REGIONAL_GROUP AS REGIONAL_GROUP,
... (1 Reply)
I have some records to be updated in oracle table. I am using sql developer tool. could any one tell me how to update those records in oracle table. I am having excel sheet with those records. (4 Replies)
Hello,
This post is already here but want to do this with another way
Merge multiples files with multiples duplicates keys by filling "NULL" the void columns for anothers joinning files
file1.csv:
1|abc
1|def
2|ghi
2|jkl
3|mno
3|pqr
file2.csv:
1|123|jojo
1|NULL|bibi... (2 Replies)
Discussion started by: yjacknewton
2 Replies
LEARN ABOUT PHP
oci_parse
OCI_PARSE(3)OCI_PARSE(3)oci_parse - Prepares an Oracle statement for executionSYNOPSIS
resource oci_parse (resource $connection, string $sql_text)
DESCRIPTION
Prepares $sql_text using $connection and returns the statement identifier, which can be used with oci_bind_by_name(3), oci_execute(3) and
other functions.
Statement identifiers can be freed with oci_free_statement(3) or by setting the variable to NULL.
PARAMETERS
o $connection
- An Oracle connection identifier, returned by oci_connect(3), oci_pconnect(3), or oci_new_connect(3).
o $sql_text
- The SQL or PL/SQL statement. SQL statements should not end with a semi-colon (";"). PL/SQL statements should end with a semi-
colon (";").
RETURN VALUES
Returns a statement handle on success, or FALSE on error.
EXAMPLES
Example #1
oci_parse(3) example for SQL statements
<?php
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
// Parse the statement. Note there is no final semi-colon in the SQL statement
$stid = oci_parse($conn, 'SELECT * FROM employees');
oci_execute($stid);
echo "<table border='1'>
";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>
";
foreach ($row as $item) {
echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>
";
}
echo "</tr>
";
}
echo "</table>
";
?>
Example #2
oci_parse(3) example for PL/SQL statements
<?php
/*
Before running the PHP program, create a stored procedure in
SQL*Plus or SQL Developer:
CREATE OR REPLACE PROCEDURE myproc(p1 IN NUMBER, p2 OUT NUMBER) AS
BEGIN
p2 := p1 * 2;
END;
*/
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$p1 = 8;
// When parsing PL/SQL programs, there should be a final semi-colon in the string
$stid = oci_parse($conn, 'begin myproc(:p1, :p2); end;');
oci_bind_by_name($stid, ':p1', $p1);
oci_bind_by_name($stid, ':p2', $p2, 40);
oci_execute($stid);
print "$p2
"; // prints 16
oci_free_statement($stid);
oci_close($conn);
?>
NOTES
Note
This function does not validate $sql_text. The only way to find out if $sql_text is a valid SQL or PL/SQL statement is to execute
it.
SEE ALSO oci_execute(3), oci_free_statement(3).
PHP Documentation Group OCI_PARSE(3)