
489 P.2d 385 (1971)
Donald J. MAYER, Appellant and Cross-Respondent,
v.
FIRST NATIONAL BANK OF OREGON, Respondent,
Ferris F. Boothe, Individually and As Trustee, et al., Respondents and Cross-Appellants.
Supreme Court of Oregon.
Argued and Submitted June 2, 1971.
Decided September 29, 1971.
*387 David W. Harper and Donald H. Pearlman, Portland, argued the cause for appellant and cross-respondent. On the briefs were Keane, Haessler, Harper & Pearlman, and Alan L. Schneider, Portland.
Douglas M. Ragen, Portland, argued the cause for respondent First National Bank. With him on the briefs were Miller, Anderson, Nash, Yerke & Wiener, Portland.
Ferris F. Boothe, Portland, argued the cause pro se; and Robert L. Allen, Portland argued the cause for respondents and cross-appellants Anderton, Pierce and Nehl. On the brief were Black, Kendall, Tremaine, Boothe & Higgins and Morrison & Bailey and Robert L. Allen, Portland.
Before O'CONNELL, C.J., and McALLISTER, DENECKE, HOLMAN, and HOWELL, JJ.
McALLISTER, Justice.
This declaratory judgment proceeding was brought by Donald J. Mayer to obtain a declaration of his rights arising out of a series of financial transactions involving Pam Corporation, a manufacturing concern, the First National Bank of Oregon, and others, including plaintiff. The transactions occurred during a three-year period preceding Pam's bankruptcy in 1967. A brief resume of these transactions is necessary to an understanding of the issues involved in this appeal.
In 1964 First National Bank extended a line of credit to Pam and took as security for its loans a security interest in Pam's inventory, accounts receivable, and contract rights. Thereafter, until its bankruptcy, Pam was at all times indebted to the bank in varying amounts, all secured by that security interest.[1]
Pam also borrowed money from defendant Ferris F. Boothe, an officer and director of Pam, and from defendant Helen Anderton, the mother of David Anderton, Pam's president and majority shareholder. In October, 1965, at the request of the bank, defendants Boothe and Anderton executed Subordination Agreements, in which they agreed to subordinate Pam's debts to them to all present and future indebtedness of Pam to the bank. They promised, in these agreements, not to accept any payments or to take any security from *388 Pam without the prior written consent of the bank. These agreements were to terminate when all of Pam's obligations to the bank were fully discharged.
In 1966 plaintiff, who had not previously had any dealings with Pam, became interested in the company. Pam was in need of additional operating capital and the bank was unwilling to increase its loan at that time on the strength of the collateral it then held. Plaintiff agreed with Pam to deposit with the bank certain shares of stock in Sawyer's, Inc., owned by him as additional collateral for the bank's loans to Pam. In return, Pam agreed to loan plaintiff $25,000 in cash, to give him a position on Pam's board of directors, and to give him an option to purchase up to 3,000 shares of Pam stock at $10 per share.
Plaintiff, pursuant to this agreement, deposited his Sawyer's stock with the bank on May 9, 1966. As a part of this transaction, Pam executed in favor of the bank a Collateral Agreement in which the bank was given various powers in connection with the new collateral, including the following:
"The Bank may assign the whole or any part of said indebtedness, obligations or liabilities of the undersigned and may transfer therewith as collateral security therefor the whole or any part of the collaterals covered by this agreement, * * *."
On the same printed form plaintiff signed an agreement reciting the deposit of his stock with the bank and providing:
"Said property may be held by the Bank as collateral security for the payment of any and all indebtedness of the Debtor [Pam] now or hereafter owing, to the same extent, in the same manner and for the same purposes as though said property were owned by the Debtor and were included in the foregoing Collateral Agreement."
The only restriction which the agreement imposed on the bank's use of plaintiff's stock was that it could only be used as security for a maximum of $100,000 of Pam's indebtedness.[2]
In November, 1966, Pam executed a loan security agreement giving defendant Boothe, individually and as trustee for defendant Anderton and certain other creditors of Pam, a security interest in Pam's inventory, operating equipment and accounts receivable. So far as the record shows, the bank did not consent in writing to this arrangement  a consent which Boothe and Anderton, under the terms of the Subordination Agreements of October, 1965, were required to obtain before taking any security from Pam.
By February, 1967, Pam was again in need of operating capital which the bank was unwilling to loan. To help supply the needed funds, defendants Boothe, Pierce and Nehl[3] each agreed to make $10,000 available to the corporation on a secured basis. To accomplish this they arranged to advance the money to Pam through the bank. This arrangement is embodied in Participation Agreements, executed by these defendants, in which they each agreed to deliver $10,000 to the bank and the bank agreed to issue to them participation certificates which were to be "deemed an assignment of participation" in *389 Pam's indebtedness to the bank. The agreements further provided for the order in which payments, collections, and "proceeds of any security" were to be applied to the bank's share of the indebtedness and to the participators' shares. The $30,000 was made available to the bank on these terms, and was advanced to Pam by the bank.
Pam's affairs continued to deteriorate, and in the summer of 1967 it became bankrupt. In June, about a month before the petition in bankruptcy was filed, Pam surrendered its accounts receivable and inventory to the bank and its operating equipment to Boothe as trustee for the secured parties under the November, 1966, Loan Security Agreement. Boothe, with the knowledge of the bank, proceeded to realize on the equipment by sale and lease. The bank took over collection of Pam's accounts receivable and began to realize on the inventory. In November, 1967, the bank sold some of plaintiff's stock and applied the proceeds to the Pam indebtedness. In May, 1969, the bank sold more of plaintiff's stock and returned the unsold shares to plaintiff. The bank eventually recovered all of its loan to Pam and repaid to Boothe, Pierce and Nehl their participating shares in this loan plus interest.
In his complaint, plaintiff alleged his contentions that he was subrogated to the rights of the bank against Boothe and Anderton under the Subordination Agreements of October, 1965, and that the repayments to Boothe, Anderton, and Nehl of their participation shares were made out of the proceeds of plaintiff's stock in violation of his rights and should be repaid to him. Other controversies were also alleged, which are not involved in this appeal. Plaintiff prayed for a declaration of all of the rights of the parties, and for appropriate money judgments.
The issues as framed by the pleadings were quite complex. At a pre-trial conference the parties and the court agreed to try certain segregated issues before the court without a jury before proceeding to a determination of the remaining issues in the case. No record was made of this pre-trial conference. In a letter to the court, with copies to other counsel, plaintiff's counsel indicated his understanding of the issues segregated for trial to the court:
"The segregated issues as the Court stated them are as follows:
"1. In the transaction of May 9, 1966 between Bank, Pam and Mayer, was Mayer putting up collateral security or making an investment? (It is plaintiff's contention that as a matter of law the result is the same under the facts in this case regardless of how the Court decides this issue).
"2. Is Mayer subrogated to the rights of the bank? (Here I would assume the same issue to be whether Mayer was a surety or guarantor of Pam for its debt to the bank. It is our understanding that we are not going to cover any collateral issues raised by subsequent activities after May 9, 1966, except for the facts admitted in the pleadings.)"
Plaintiff's restatement of the issues in this letter apparently went unchallenged by the other parties. A trial was held and thereafter the court entered its "Findings of Fact and Conclusions of Law and Judgment and Decree" in which it held that plaintiff, when he deposited his stock with the bank as security for Pam's indebtedness, did so as a pledgor, not as an investor. As pledgor, the trial court concluded, plaintiff had "certain of the rights of a surety"; however, plaintiff was held not to be entitled, by virtue of subrogation to the rights of the bank, to enforce the Subordination Agreements of October, 1965, against defendants Boothe and Anderton. The trial court also held that plaintiff had no right to recover from defendants Boothe, Pierce, and Nehl the amounts they received from the bank under their Participation Agreements of February, 1967.
*390 Plaintiff on appeal claims that both of these questions were incorrectly decided by the trial court. He also vigorously asserts that neither of these issues ought to have been decided by the trial court at all because they were not within the issues which the parties had agreed to try as segregated issues before the court and because they involved issues of fact which plaintiff had a right to have tried to a jury.
As to the question of his right to enforce the Subordination Agreements, plaintiff insists, as he did in the trial court proceedings, that this was not involved in the issue of whether he was subrogated to the rights of the bank. He contends that the existence of the right of subrogation is a separate issue from the enforceability of that right, and that the trial court should have decided only the former and left the latter for determination in subsequent proceedings. We think the trial court was correct in proceeding to determine the entire question of plaintiff's subrogation rights under the issues as agreed upon.
Plaintiff, in support of his position, relies on authorities which appear to draw a distinction between the right of subrogation and the enforceability of the rights thus acquired. In Cooper v. Sagert, 111 Or. 27, 34-35, 223 P. 943 (1924) this court said:
"The modern rule seems to be that a surety by payment does not become ipso facto subrogated to the rights of the creditor, but only acquires a right to subrogation, and that, before the substitution or equitable assignment can actually take place, he must actively assert his equitable right thereto.
"It is not a substantive tangible right of such a nature and character that it can be seized and held and enjoyed independently of a judicial proceeding. For this purpose, resort must be had to a civil action. There are two distinct sets of facts in such cases; one consists of those facts that show the right to be subrogated to the rights of the creditor in the securities held by the latter; the other consists of those facts which show that the security may be enforced against the principal. * * * The facts showing the right of subrogation are not pleaded, and the question does not arise in this case."
The failure in the pleadings to which the court alluded was a failure to allege that the party through whom plaintiff claimed a right of subrogation had at the time of trial any rights to which plaintiff could be subrogated. The opinion does not approve, even in principle, the notion that a party may assert, or a court decide, that he has become subrogated to the rights of another without regard to what those rights are, against whom they exist, and whether they can be enforced.
Similarly in California Bank v. United States Fidelity & Guaranty Co., 129 F.2d 751, 753 (9th Cir.1942) the court held that there could be no recovery on a theory of subrogation because the parties whom plaintiff surety in that case had paid had no rights against the defendant bank. We do not think the language the court employed in passing, quoted in plaintiff's brief,[4] was intended to suggest that a court can determine the existence of a right of subrogation in a vacuum.
On the contrary, rights obtained by subrogation, especially when they are to be enforced against persons other than the principal debtor, are determined to exist only after a consideration of the facts of the case and the relative equities of the parties. See, e.g., United States Fid. & Guar. Co. v. Thomlinson Arkwright Co., 172 Or. 307, 331-335, 141 P.2d 817 (1943); *391 American Central Ins. Co. v. Weller, 106 Or. 494, 502, 212 P. 803 (1923); Wasco County v. New England E. Ins. Co., 88 Or. 465, 471-472, 172 P. 126 (1918). When the parties in this case agreed that the court was to determine whether plaintiff was subrogated to the rights of the bank, they necessarily placed before the court the questions of what rights plaintiff claimed by way of subrogation and whether, under the circumstances, those rights would be enforceable by plaintiff as subrogee.
We also hold that the trial court reached the proper result on the merits of this question. Plaintiff's claim against Boothe and Anderton is based on their violation of the Subordination Agreements in which they agreed not to accept any payments on the debt owing to them by Pam or any security for that debt until Pam's obligations to the bank were discharged in full. Plaintiff alleged, and the defendants admitted, that the bank knew of and agreed to Boothe's exercise of the rights of a secured party when, shortly before Pam's bankruptcy, he took possession of and proceeded to liquidate Pam's operating equipment.
A surety who is compelled to pay the debt of his principal becomes subrogated only to rights and remedies of the creditor which are in existence immediately prior to the payment. Alexander v. Young, 65 F.2d 752, 757 (10th Cir.1933); Commercial Casualty Ins. Co. v. Board of Com'rs, 215 Ind. 440, 19 N.E.2d 476, 477-478 (1939); Leach v. Commercial Sav. Bank, 205 Iowa 1154, 213 N.W. 517, 520 (1927); Restatement, Security 383-384, Comment a to § 141.
In the present case it is alleged and admitted in the pleadings that the bank, prior to its sale of plaintiff's stock for application on Pam's debt, had already consented to Boothe's assertion of his security rights by taking possession of Pam's equipment. Having consented to Boothe's actions, the bank could not have enforced the provisions of the Subordination Agreements which required Boothe and Anderton to obtain prior written permission before taking security from Pam. The bank having, at the time of the application of plaintiff's stock to Pam's debt, no enforceable rights against Boothe and Anderton in this respect, there was nothing to which plaintiff could become subrogated.
Moreover, the Subordination Agreements expired by their own terms when Pam's debt to the bank was fully discharged. Boothe and Anderton did not, under these agreements, have any duty to pay Pam's debt to the bank. They simply agreed to postpone collection of the amounts Pam owed them until the bank had been paid, and not to take any security in the meantime. The debt to the bank has been paid in full, and all duties under the Subordination Agreements terminated with that payment.
The second issue which plaintiff claims the trial court ought not to have decided is whether plaintiff can recover from Boothe, Pierce, and Nehl the amounts they received from the bank in repayment of their advances under the Participation Agreements. Plaintiff is correct in his contention that this issue was not within those segregated by the parties and the court for initial determination. No claim of subrogation was involved; plaintiff's position was simply that these defendants had no right to share in the security he had provided the bank, and no right to receive payments out of the proceeds of its sale. None of the defendants have attempted to argue that this matter was within the issues segregated at the pre-trial conference, and we think it clear that it was not. We must consider, then, whether plaintiff is entitled to a reversal of the trial court's decision on this account.
Plaintiff complains that he was denied a fair hearing on this issue, but the *392 record does not support this complaint. At the end of the first day of the hearing the trial court announced that the Participation Agreements would be considered on the following day. Plaintiff's counsel protested that this matter was not included in the subrogation issue which the parties had agreed to try, but he did not claim that he needed more time to prepare for the trial of the question. On the following day when the trial court agreed to hear evidence concerning the Participation Agreements, plaintiff's counsel again protested that his claim involving these agreements was not within the issues as framed at the pre-trial conference. He also said that there was evidence on this question that he wished to introduce but did not have immediately available. A discussion followed in which the parties, with the court's permission, stipulated to some of the circumstances leading up to the execution of the Participation Agreements. Plaintiff testified to his version of those circumstances. After all the stipulated facts and testimony on this issue were before the court the following exchange took place:
"THE COURT: Can we say, as to this issue then, * * * that the parties have submitted all the evidence they desire on this issue?
"MR. HARPER: All the testimony.
* * * * * *
"THE COURT: Do you want me to resolve that issue?
"MR. HARPER: I have evidence to come in.
"THE COURT: The evidence is substantially what you have told me it will be?
"MR. HARPER: Yes.
"THE COURT: Based on this, I will let you make your record clear on that, but I am prepared to decide on this issue."
The "evidence to come in" which plaintiff's counsel referred to consisted of bank records which were produced and admitted the following day. Plaintiff did not indicate to the trial court that he was in any way dissatisfied with the state of the evidence on this issue. In the absence of any such indication, we cannot find that plaintiff was prejudiced by the trial court's determination to proceed with the resolution of this issue.
Plaintiff also complains, however, that he was denied his right to a jury trial on this issue. He contends that this claim was an action at law for money had and received, and that he had a right to have his claim determined by a jury.
Plaintiff's complaint combined a request for declaratory relief on this and other issues with a prayer for various money judgments. We have held that declaratory judgment proceedings will be treated as either legal or equitable, depending upon the essential nature of the case. Oregon Farm Bureau v. Thompson, 235 Or. 162, 179, 378 P.2d 563, 384 P.2d 182 (1963). In the present case the subject matter and the relief sought do not provide a single clear answer to the question whether this is a "legal" or "equitable" declaratory judgment proceeding. Plaintiff's major concern in this case was to have the court determine his rights as subrogee. This portion of the case has a distinctly equitable cast. Subrogation is a doctrine of equitable origin, and the existence of a right of subrogation is determined according to equitable principles. Jenks Hatchery, Inc. v. Elliott, 252 Or. 25, 31, 448 P.2d 370 (1968); MacNab v. Fireman's Fund Ins. Co., 243 Or. 267, 272, 413 P.2d 413 (1966); American Cent. Ins. Co. v. Weller, 106 Or. 494, 502, 212 P. 803 (1923); Wasco County v. New England Equitable Ins. Co., 88 Or. 465, 469-471, 172 P. 126, LRA 1918D, 732, Ann.Cas. 1918E, 656 (1918). Although subrogation rights will be adjudicated and *393 enforced in appropriate actions at law, the above cases make it clear that the equitable origins of the doctrine nevertheless guide its application. We are of the opinion that where, as here, the basic question to be determined in a declaratory judgment proceeding is whether rights of subrogation exist, that proceeding is equitable in nature. Plaintiff has combined with his equitable claim to the right to subrogation, a claim, which he contends is purely legal  his claim to the money paid to Boothe, Pierce and Nehl under the Participation Agreements, which he characterizes as an action for money had and received. There is no authority in our statutes for joining legal and equitable causes in a single proceeding. See ORS 16.220 and 16.230. Nor do the declaratory judgment statutes provide such authority. ORS 28.010 provides that courts "shall have power to declare rights, status, and other legal relations, whether or not further relief is or could be claimed." The provision for declaratory and "further" relief in a single proceeding does not change the rule that a plaintiff must determine whether his remedy is at law or in equity and proceed accordingly.
In Lewis v. Miller, 197 Or. 354, 251 P.2d 876 (1953) the plaintiff sought three kinds of relief: (1) a declaratory judgment; (2) reformation of a contract; and (3) a money judgment. The defendant demurred to the complaint on the ground that the causes were improperly joined; the trial court overruled the demurrer and this court affirmed. In Lewis, however, the court held that the claim for money damages was merely incidental or supplemental to the reformation claim and could have been pleaded as an integral part of that count. The court also pointed out that "each of the three separately stated causes is related to and springs from the same contract between the same parties." 197 Or. at 359, 251 P.2d at 878. In this case, on the other hand, the claim under the Participation Agreements involves other parties and a separate transaction. It is clearly a separate cause, and not a part of or incidental to plaintiff's other claims based on subrogation. The causes are not, however, separately stated in the complaint; the allegations of facts concerning the entire series of interrelated transactions are intermingled, and many are relevant to both causes, as was much of the evidence in the trial court.
Having invoked the aid of a court of equity to establish his equitable right of subrogation, plaintiff is not entitled to have his case tried piecemeal because he commingled with his claim to equitable relief a distinct legal claim which arose out of the same integrated series of transactions. Under these circumstances, the case is a proper one for the application of the rule that equity, having obtained jurisdiction of the matter, will proceed to a full adjudication of the issues between the parties, including legal as well as equitable matters. Wells v. Wells, 252 Or. 400, 406, 449 P.2d 434 (1969); Corder v. A & J Lumber Co., Inc., 223 Or. 443, 449, 354 P.2d 807 (1960); Duke v. Franklin, 177 Or. 297, 302-303, 162 P.2d 141 (1945); Ruby v. West Coast Lbr. Co., 139 Or. 388, 393-394, 10 P.2d 358 (1932).
In the federal courts, where law and equity have been merged, cases involving both legal and equitable causes are common, and plaintiffs in such cases are entitled to a jury determination of the legal causes. See, e.g., Ring v. Spina, 166 F.2d 546, 550 (2d Cir.1948); Bruckman v. Hollzer, 152 F.2d 730, 732 (9th Cir.1946). See, also, Dairy Queen v. Wood, 369 U.S. 469, 82 S.Ct. 894, 8 L.Ed.2d 44 (1962); Rowell v. Kaplan, 103 R.I. 60, 235 A.2d 91, 96 (1967). But where the joinder of legal and equitable causes is improper under the applicable procedure, plaintiff ought not to be heard to complain that he has been deprived of a jury trial on some of the issues. The situation in which plaintiff finds himself is of his own making.
We also hold that the trial court was correct in determining that plaintiff *394 had no right to recover the money paid to Boothe, Pierce, and Nehl. The Collateral Agreement executed by Pam contained a paragraph, quoted above, permitting the bank to assign all or any part of Pam's indebtedness to others, and to transfer any part of the collateral as a part of such an assignment. Plaintiff agreed that his stock was to be held by the bank "to the same extent, in the same manner and for the same purposes as though said property were owned by the Debtor and were included in the foregoing Collateral Agreement." Neither agreement contained any limitation on the total amount the bank could loan to Pam, or the terms of any assignment of a portion of this debt by the bank. The Participation Agreements provided, in effect, for a partial assignment of the Pam debt. Because the bank assigned only the portion of the debt represented by funds advanced by the assignees, plaintiff contends that the participation arrangement was a device which increased his exposure as surety without a corresponding increase of exposure on the bank's part. This may be true, but in doing this the bank was acting within the terms of its agreement with plaintiff. Had the bank loaned Pam an additional $30,000 and assigned that portion of Pam's debt to Boothe, Pierce and Nehl in return for their payment of $10,000 each, plaintiff could not have complained. As part of such an assignment the bank could have transferred a portion of plaintiff's stock to its assignees as collateral for their share of the debt. Instead of doing this, the bank assigned "participation" rights in the debt without a transfer of collateral, and agreed to repay the participators out of its own collections. We think this transaction was within the bank's authority to assign part of the debt to others, to which plaintiff agreed. There was nothing wrongful about the Participation Agreements or the repayments to Boothe, Pierce and Nehl according to their terms.
We have disposed of all the issues raised by plaintiff's appeal. Defendants Boothe and Anderton cross-appealed, contending that the trial court erred in failing to marshal assets in their favor. They claim that the bank ought to have exhausted plaintiff's security before resorting to Pam's inventory and accounts receivable, in which these defendants claimed a security interest inferior in priority to that of the bank. This contention, however, depends upon the theory that plaintiff was not a surety for Pam's debt but was rather an investor in the corporation. Dickson v. Back, 32 Or. 217, 239, 51 P. 727 (1897); Annotation, 135 ALR 738. The trial court was clearly correct in holding that plaintiff pledged his stock as security for Pam's debt to the bank. To the extent of the pledge he was a surety for Pam. The cross-appeal is without merit.
The decree of the trial court is affirmed.
NOTES
[1]  New agreements were substituted periodically which were identical with the first. We need not be concerned with these later agreements, however, because there is no question but that the bank perfected its security interest and preserved its priority throughout the period in question.
[2]  "Provided that said property shall be applicable to indebtedness of Debtor in an amount not exceeding $125,000 until a note of the undersigned to the Debtor in the amount of $25,000, and this day pledged with the Bank, has been paid, after which said property shall be applicable to indebtedness of Debtor in an amount not exceeding $100,000. The Bank at its option may proceed against said property directly and independently without proceeding against the Debtor or against any other collateral." The $25,000 note was paid. When the bank later sold part of plaintiff's stock to apply to Pam's debt the $100,000 limitation was in effect. There is no contention that it was not observed.
[3]  Pierce was a shareholder and director of Pam and Nehl was a former shareholder.
[4]  "Appellee contends, and correctly so, that it became subrogated to the rights of the materialmen whose claims it paid. Appellee, however, did not thereby acquire the right to recover of appellant the amounts paid the materialmen; * * *."
