Announcement

Collapse
No announcement yet.

Oracle-Funktionen mit Rowtype als Result aufrufen

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Oracle-Funktionen mit Rowtype als Result aufrufen

    Hallo,<br>
    ich möchte eine Oracle-Funktion in Delphi aufrufen, die einen Rowtype zurückgibt:<p>
    z.B.:<br>
    <code><pre>
    <font face="Courier New"><font color="#000000"><b>create</b></font><font color="#000000"> </font><font color="#000000"><b>or</b></font><font color="#000000"> </font><font color="#000000">replace</font><font color="#000000"> </font><font color="#000000"><b>function</b></font><font color="#000000"> </font><font color="#000000">TestFunktion</font><font color="#000000"> </font><font color="#000000">return</font><font color="#000000"> </font><font color="#000000">Mitarbeiter</font><font color="#000000">%</font><font color="#000000">rowtype</font><font color="#000000"> </font><font color="#000000"><b>is</b></font>
    <font color="#000000"> </font><font color="#000000">Result</font><font color="#000000"> </font><font color="#000000">Mitarbeiter</font><font color="#000000">%</font><font color="#000000">rowtype</font><font color="#000000">;</font>
    <font color="#000000"><b>begin</b></font>
    <font color="#000000"> </font><font color="#000000"><b>select</b></font><font color="#000000"> </font><font color="#000000">*</font><font color="#000000"> </font><font color="#000000"><b>into</b></font><font color="#000000"> </font><font color="#000000">Result</font><font color="#000000"> </font><font color="#000000"><b>from</b></font><font color="#000000"> </font><font color="#000000">Mitarbeiter</font><font color="#000000"> </font><font color="#000000"><b>where</b></font><font color="#000000"> </font><font color="#000000">MitNr</font><font color="#000000">=</font><font color="#000000">1234</font><font color="#000000">;</font>
    <font color="#000000"> </font><font color="#000000">return</font><font color="#000000">(</font><font color="#000000">Result</font><font color="#000000">)</font><font color="#000000">;</font>
    <font color="#000000"><b>end</b></font><font color="#000000">;</font></font>
    </pre></code><p>
    Wie kann ich das Ergebnis in Delphi verarbeiten? Verwende ich die TQuery mit "select * from Test" erhalte ich die Fehlermeldung "Allgemeiner SQL Fehler; ORA-04044 procedure, function, package or type not allowed here".<p>
    Versuche mit der StoredProc scheiterten genauso kläglich (Paramter werden nicht automatisch erkannt, beim Ausführen: "Allgemeiner SQL-Fehler; PLS-00221: 'TEST' is not a procedure or is undefined"). Warum werden die Paramter nicht automatisch erkannt? Welchen Typ muss so ein Parameter haben wenn ich ein ROWTYPE zurückgebe? Muss ein Rückgabeparameter einen bestimmten Namen haben oder ist der egal???<p>
    <br>
    Danke für jede Hilfe *hoff*,<br>
    Gruß,<br>
    Bernhard
Working...
X